{"id":22614036,"url":"https://github.com/labrodev/php-mixed-converter","last_synced_at":"2026-01-24T06:41:27.105Z","repository":{"id":253534272,"uuid":"843792623","full_name":"labrodev/php-mixed-converter","owner":"labrodev","description":"PHP utility class that provides methods to convert mixed values to strings, ints or floats.","archived":false,"fork":false,"pushed_at":"2024-08-17T12:55:00.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-27T05:41:31.900Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/labrodev.png","metadata":{"files":{"readme":"README.MD","changelog":"CHANGELOG.MD","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-08-17T12:40:17.000Z","updated_at":"2024-08-17T12:51:59.000Z","dependencies_parsed_at":null,"dependency_job_id":"91c86e5d-ec68-496c-91d4-6c3af8c6b80a","html_url":"https://github.com/labrodev/php-mixed-converter","commit_stats":null,"previous_names":["labrodev/php-mixed-converter"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/labrodev/php-mixed-converter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labrodev%2Fphp-mixed-converter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labrodev%2Fphp-mixed-converter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labrodev%2Fphp-mixed-converter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labrodev%2Fphp-mixed-converter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/labrodev","download_url":"https://codeload.github.com/labrodev/php-mixed-converter/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/labrodev%2Fphp-mixed-converter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28716873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T05:53:42.649Z","status":"ssl_error","status_checked_at":"2026-01-24T05:53:41.698Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-08T18:07:25.562Z","updated_at":"2026-01-24T06:41:27.094Z","avatar_url":"https://github.com/labrodev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Description\n\nPhpMixedConvert is PHP utility class that provides methods to convert mixed values to strings, ints or floats.\n\nSometimes there is necessity in a code to ensure that our variable is string, int or float, especially strict types declaration is enabled in the class. On other hand, there is sometimes cases when the exact type is unknown. For example, it happens often in Laravel and probably could happen in any other project/code structure. \n\nSo this utility class has 3 static methods to just convert variable with mixed type to certain type depends on context. \n\nP.S. We surely could detect such cases when to convert from mixed to exact type due static analysis (for example, wtih PHPStan).\n\n## Installation\n\nTo install the package, run the following command in your Laravel project:\n\n```bash\ncomposer require labrodev/php-mixed-converter\n```\n\n## Requirements\n\n- PHP 8.1 or higher\n\n## Configuration\n\nAfter installing the package, no additional configuration is needed to start using utility.\n\n## Usage\n\nTo use the utility, use Utility class in your class and just call existed static methods from it:\n\n```php \n\n\u003c?php\n\nnamespace YourNamespace;\n\nuse Labrodev\\PhpMixedConverter\\MixedConverter;\n\nclass YourClass extends Model\n{\n   \n    // somewhere in your code\n\n    // convert mixed to string\n    $value = MixedConverter::toString($value);\n\n    // convert mixed to float\n    $value = MixedConverter::toFloat($value);\n\n    // convert mixed to int\n    $value = MixedConverter::toInt($value);\n\n}\n```\n\n## Testing\n\nTo run the tests included with the package, execute the following command:\n\n```bash\ncomposer test\n```\n\n## Security\n\nIf you discover any security-related issues, please email admin@labrodev.com instead of using the issue tracker.\n\n## Credits\n\nLabro Dev\n\n## License\n\nThe MIT License (MIT). Please see License File for more information.\n\n## Read more\n\nRead more about our web development experince on our [Substack page - Labrodev](https://labrodev.substack.com).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabrodev%2Fphp-mixed-converter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flabrodev%2Fphp-mixed-converter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flabrodev%2Fphp-mixed-converter/lists"}