sushi-market / smart-cast
Smart casts for PHP
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/sushi-market/smart-cast
Requires
- php: ^8.1
Requires (Dev)
- laravel/pint: ^1.24.0
- peckphp/peck: ^0.1.3
- pestphp/pest: ^4.1.0
- pestphp/pest-plugin-type-coverage: ^4.0.2
- phpstan/phpstan: ^2.1.26
- rector/rector: ^2.1.7
- symfony/var-dumper: ^7.3.3
This package is auto-updated.
Last update: 2025-10-24 13:13:19 UTC
README
Smart Cast - An elegant and type-safe library for intelligent type casting in PHP. Eliminate boilerplate code and work with data confidently!
✨ Features
- 🎯 Intuitive API - Simple and clear syntax
- 🛡️ Type Safety - Comprehensive validation and exception handling
- 🚀 Performance - Optimized conversions with minimal overhead
- 📦 Zero Dependencies - No external dependencies required
🚀 Quick Start
Installation
composer require sushi-market/smart-cast
<?php use DF\SmartCast; use DF\NumberSign; // Convert string to integer $intValue = SmartCast::stringToInt('123'); // Returns 123 // Convert with sign validation $positiveInt = SmartCast::stringToInt('456', NumberSign::POSITIVE); // Convert to float $floatValue = SmartCast::stringToFloat('123.45'); // Returns 123.45 // Convert to boolean $boolValue = SmartCast::stringToBoolean('true'); // Returns true