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

v1.0.0 2025-10-24 13:11 UTC

This package is auto-updated.

Last update: 2025-10-24 13:13:19 UTC


README

PHP Version License

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