{"id":28126165,"url":"https://github.com/t-labs-co/booleanize","last_synced_at":"2026-02-12T09:33:43.809Z","repository":{"id":283010406,"uuid":"945367796","full_name":"T-Labs-Co/booleanize","owner":"T-Labs-Co","description":"Helper for Boolean manipulation easier","archived":false,"fork":false,"pushed_at":"2026-01-12T06:05:21.000Z","size":50,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-12T16:10:38.677Z","etag":null,"topics":["boolean","booleanize","boolify","laravel","package","php","t-labs-co"],"latest_commit_sha":null,"homepage":"","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/T-Labs-Co.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"ty-huynh"}},"created_at":"2025-03-09T08:49:32.000Z","updated_at":"2026-01-12T06:05:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"a75590b1-651d-4074-be8c-4f2d537daaa9","html_url":"https://github.com/T-Labs-Co/booleanize","commit_stats":null,"previous_names":["t-labs-co/booleanize"],"tags_count":1,"template":false,"template_full_name":"spatie/package-skeleton-laravel","purl":"pkg:github/T-Labs-Co/booleanize","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/T-Labs-Co%2Fbooleanize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/T-Labs-Co%2Fbooleanize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/T-Labs-Co%2Fbooleanize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/T-Labs-Co%2Fbooleanize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/T-Labs-Co","download_url":"https://codeload.github.com/T-Labs-Co/booleanize/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/T-Labs-Co%2Fbooleanize/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29362847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T08:51:36.827Z","status":"ssl_error","status_checked_at":"2026-02-12T08:51:26.849Z","response_time":55,"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":["boolean","booleanize","boolify","laravel","package","php","t-labs-co"],"created_at":"2025-05-14T10:23:38.835Z","updated_at":"2026-02-12T09:33:43.798Z","avatar_url":"https://github.com/T-Labs-Co.png","language":"PHP","funding_links":["https://github.com/sponsors/ty-huynh"],"categories":[],"sub_categories":[],"readme":"# Helper to work with Boolean in less pain way\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/t-labs-co/booleanize.svg?style=flat-square)](https://packagist.org/packages/t-labs-co/booleanize)\n[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/t-labs-co/booleanize/run-tests.yml?branch=main\u0026label=tests\u0026style=flat-square)](https://github.com/t-labs-co/booleanize/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/t-labs-co/booleanize/fix-php-code-style-issues.yml?branch=main\u0026label=code%20style\u0026style=flat-square)](https://github.com/t-labs-co/booleanize/actions?query=workflow%3A\"Fix+PHP+code+style+issues\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/t-labs-co/booleanize.svg?style=flat-square)](https://packagist.org/packages/t-labs-co/booleanize)\n\nThis package helps you deal with **Boolean value** in your laravel project, support action **cast model attribute, check value is true/false, convert to your desire boolean form**. It's super handy for keeping things clean and avoiding copy-paste, so you can grab what you need quickly and cut down on extra coding.\n\n## Work with us\n\nWe're PHP and Laravel whizzes, and we'd love to work with you! We can:\n\n- Design the perfect fit solution for your app.\n- Make your code cleaner and faster.\n- Refactoring and Optimize performance.\n- Ensure Laravel best practices are followed.\n- Provide expert Laravel support.\n- Review code and Quality Assurance.\n- Offer team and project leadership.\n- Delivery Manager\n\n## PHP and Laravel Version Support\n\nThis package supports the following versions of PHP and Laravel:\n\n- PHP: `^8.2`\n- Laravel: `^11.0`, `^12.0`\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require t-labs-co/booleanize\n```\n\nYou can publish the config file with:\n\n```bash\nphp artisan vendor:publish --tag=\"booleanize-config\"\n```\n\nThis is the contents of the published config file:\n\n```php\nreturn [\n// Override your configuration \n];\n```\n\n## Feature \n\n- Check input value is `true` or `false` \n- Convert input value to desired Boolean form \n- Cast model attribute to correct value \n- Query boolean field\n- Validate rule for boolean field \n\n## Usage\n\n#### Convert to bool with helper\n\n```php\n// use helper class \nbooleanize('true', null, true); // OUTPUT: true\n\n// or call instance and using\nbooleanize()-\u003econvert('Yes', null, true); // OUTPUT: true \nbooleanize()-\u003econvert('Yes', null, 1); // OUTPUT: 1 \n\nbooleanize()-\u003econvert('No', null, true); // OUTPUT: false \nbooleanize()-\u003econvert('No', null, 1); // OUTPUT: 0 \n```\n\n#### Using in Model class\n\n```php\n// model class \n\nclass User extends Authenticatable\n{\n    use HasBooleanizeTrait;\n    \n    // cast using \n    protected function casts(): array\n    {\n        return [\n            'agreed' =\u003e BooleanizeCast::class\n        ];\n    }\n    \n    // setting cast type SET and GET\n    public function getTrueValueAs(): array\n    {\n        // config your default true value for your attribute when GET\n        return [\n            'agreed' =\u003e 1\n        ];\n    }\n    \n    public function setTrueValueAs(): array\n    {\n        // config your default true value for your attribute when SET\n        return [\n            'agreed' =\u003e 'yes'\n        ];\n    }\n}\n\n// query Scope using  whereBooleanize()\n$users = User::whereBooleanize('agreed', true)-\u003eget(); \n// this will auto convert `true` to `yes` value from `setTrueValueAs()` and do query\n\n// Or shorter \n$users = User::whereBooleanizeTrue('agreed')-\u003eget();\n```\n\n#### Using in validate\n\n```php\n\n$data = [\n    'term_confirm' =\u003e 'Y'\n];\n// term_confirm could be any in [y,yes,1,true]\n$rules = [\n    'term_confirm' =\u003e ['required', new BooleanizeTrueRule()],\n];\n\nValidator::validate($data, $rules, [\n    'term_confirm' =\u003e 'Must confirm the term'\n]);\n\n```\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [T.Labs \u0026 Co.](https://github.com/ty-huynh)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft-labs-co%2Fbooleanize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ft-labs-co%2Fbooleanize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ft-labs-co%2Fbooleanize/lists"}