{"id":33984312,"url":"https://github.com/yzen-dev/typer","last_synced_at":"2026-06-05T11:31:09.076Z","repository":{"id":223195435,"uuid":"759555058","full_name":"yzen-dev/typer","owner":"yzen-dev","description":"This is a simple helper package that will help you avoid using \"if\" and ternary operators.","archived":false,"fork":false,"pushed_at":"2024-02-23T21:49:27.000Z","size":133,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-14T16:48:40.420Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yzen-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-02-18T21:52:47.000Z","updated_at":"2024-03-25T05:26:26.000Z","dependencies_parsed_at":"2024-02-22T10:46:29.947Z","dependency_job_id":null,"html_url":"https://github.com/yzen-dev/typer","commit_stats":null,"previous_names":["yzen-dev/typer"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/yzen-dev/typer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzen-dev%2Ftyper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzen-dev%2Ftyper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzen-dev%2Ftyper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzen-dev%2Ftyper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yzen-dev","download_url":"https://codeload.github.com/yzen-dev/typer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yzen-dev%2Ftyper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33939225,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-05T02:00:06.157Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2025-12-13T04:28:25.166Z","updated_at":"2026-06-05T11:31:09.048Z","avatar_url":"https://github.com/yzen-dev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Typer\n![Packagist Version](https://img.shields.io/packagist/v/yzen.dev/typer?color=blue\u0026label=version)\n![GitHub Workflow Status (with branch)](https://img.shields.io/github/actions/workflow/status/yzen-dev/typer/tests.yml?branch=master)\n[![Coverage](https://codecov.io/gh/yzen-dev/typer/branch/master/graph/badge.svg?token=QAO8STLPMI)](https://codecov.io/gh/yzen-dev/typer)\n![Packagist Downloads](https://img.shields.io/packagist/dm/yzen.dev/typer)\n![Packagist Downloads](https://img.shields.io/packagist/dt/yzen.dev/typer)\n\n[![Mutation testing badge](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyzen-dev%2Ftyper%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yzen-dev/typer/master)\n[![type-coverage](https://shepherd.dev/github/yzen-dev/typer/coverage.svg)](https://shepherd.dev/github/yzen-dev/typer)\n[![psalm-level](https://shepherd.dev/github/yzen-dev/typer/level.svg)](https://shepherd.dev/github/yzen-dev/typer)\n\nThis is a simple helper package that helps make the code cleaner. Often, when working with data from third-party sources, such as website parsing, you need to write hundreds of lines of code to check for a particular property.\n\nMost likely, you write a lot of if or ternary operators, and your code looks something like this:\n ```php\n$user = new User();\n$user-\u003eid = isset($dynamicArray['id']) ? (int)$dynamicArray['id'] : null;\n$user-\u003eemail = isset($dynamicArray['email']) ? (string)$dynamicArray['email'] : null;\n$user-\u003ebalance = isset($dynamicArray['balance']) ? (float)$dynamicArray['balance'] : null;\n$user-\u003eblocked = isset($dynamicArray['blocked']) ? ($dynamicArray['blocked'] === 'true' ? true : false) : null;\n```\n\nWhen using **Typer**, you don't need to worry about a lot of checks and transformations. Simply wrap the code in the `typer` method:\n\n```php\n$user = new User();\n$user-\u003eid = Typer::int($dynamicArray, 'id');\n$user-\u003eemail = Typer::string($dynamicArray, 'email');\n$user-\u003ebalance = Typer::float($dynamicArray, 'balance');\n$user-\u003eblocked = Typer::bool($dynamicArray, 'blocked');\n```\n\nIf, in the absence of a parameter, you need to specify a default value other than \"null\", you can simply pass it as the second argument:\n```php\n$user-\u003ebalance = Typer::float($dynamicArray, 'balance', 10.0);\n```\n## **Installation**\n\nThe package can be installed via composer:\n\n```\ncomposer require yzen.dev/typer\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyzen-dev%2Ftyper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyzen-dev%2Ftyper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyzen-dev%2Ftyper/lists"}