{"id":15014422,"url":"https://github.com/petrknap/php-shorts","last_synced_at":"2025-08-23T11:10:13.987Z","repository":{"id":205467514,"uuid":"704849970","full_name":"petrknap/php-shorts","owner":"petrknap","description":"Set of short helpers","archived":false,"fork":false,"pushed_at":"2025-04-16T17:40:49.000Z","size":55,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-22T15:41:01.392Z","etag":null,"topics":["array","helper","markdown","php","php-library","phpunit"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/petrknap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yaml","license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"custom":"https://petrknap.github.io/donate.html"}},"created_at":"2023-10-14T09:34:50.000Z","updated_at":"2025-04-16T17:40:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"ab874fd3-b016-479a-b487-64d5d7568104","html_url":"https://github.com/petrknap/php-shorts","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"c7def2f91becc292a41aead460a40ea0518ec22f"},"previous_names":["petrknap/php-shorts"],"tags_count":12,"template":false,"template_full_name":null,"purl":"pkg:github/petrknap/php-shorts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrknap%2Fphp-shorts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrknap%2Fphp-shorts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrknap%2Fphp-shorts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrknap%2Fphp-shorts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/petrknap","download_url":"https://codeload.github.com/petrknap/php-shorts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/petrknap%2Fphp-shorts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271745638,"owners_count":24813513,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"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":["array","helper","markdown","php","php-library","phpunit"],"created_at":"2024-09-24T19:45:36.392Z","updated_at":"2025-08-23T11:10:13.934Z","avatar_url":"https://github.com/petrknap.png","language":"PHP","funding_links":["https://petrknap.github.io/donate.html"],"categories":[],"sub_categories":[],"readme":"# Set of short PHP helpers\n\n* `Exception`s\n  * [`CouldNotProcessData` template](#exceptioncouldnotprocessdata-template)\n  * [`NotImplemented`](#exceptionnotimplemented)\n* [`HasRequirements` trait](#hasrequirements-trait)\n\n## [`Exception\\CouldNotProcessData` template](./src/Exception/CouldNotProcessData.php)\n\nTemplate for an exception that indicates that the data could not be processed.\n\n```php\nnamespace PetrKnap\\Shorts;\n\ninterface ImageResizerException extends \\Throwable {}\n\n/** @extends Exception\\CouldNotProcessData\u003cstring\u003e */\nfinal class ImageResizerCouldNotResizeImage extends Exception\\CouldNotProcessData implements ImageResizerException {}\n\nfinal class ImageResizer {\n    public function resize(string $image) {\n        throw new ImageResizerCouldNotResizeImage(__METHOD__, $image);\n    }\n}\n```\n\n## [`Exception\\NotImplemented`](./src/Exception/NotImplemented.php)\n\nSimple exception for prototyping purposes.\n\n```php\nnamespace PetrKnap\\Shorts;\n\nfinal class StringablePrototype implements \\Stringable {\n    public function __toString(): string {\n        Exception\\NotImplemented::throw(__METHOD__);\n    }\n}\n```\n\n## [`HasRequirements` trait](./src/HasRequirements.php)\n\nSimple trait to check if requirements of your code are fulfilled.\n\n```php\nnamespace PetrKnap\\Shorts;\n\nfinal class ServiceWithRequirements {\n    use HasRequirements;\n    \n    public function __construct() {\n        self::checkRequirements(functions: ['required_function']);\n    }\n\n    public function do(): void {\n        required_function();\n    }\n}\n```\n\nIt should not replace [Composers](https://getcomposer.org/) [`require`s](https://getcomposer.org/doc/04-schema.md#require),\nbut it could improve them and check [`suggest`s](https://getcomposer.org/doc/04-schema.md#suggest).\n\n---\n\nRun `composer require petrknap/shorts` to install it.\nYou can [support this project via donation](https://petrknap.github.io/donate.html).\nThe project is licensed under [the terms of the `LGPL-3.0-or-later`](./COPYING.LESSER).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetrknap%2Fphp-shorts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpetrknap%2Fphp-shorts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpetrknap%2Fphp-shorts/lists"}