{"id":18637984,"url":"https://github.com/imponeer/object-errors","last_synced_at":"2025-10-12T23:39:16.707Z","repository":{"id":39916238,"uuid":"124806811","full_name":"imponeer/object-errors","owner":"imponeer","description":"Library that adds a possibility to collect errors for objects","archived":false,"fork":false,"pushed_at":"2025-10-01T00:02:45.000Z","size":149,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-01T02:29:18.539Z","etag":null,"topics":["errors","hacktoberfest","object","php-library"],"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/imponeer.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2018-03-11T22:46:38.000Z","updated_at":"2025-10-01T00:02:48.000Z","dependencies_parsed_at":"2023-02-01T12:32:13.814Z","dependency_job_id":"c72be105-8ac2-470e-b5cf-562ce3a86db3","html_url":"https://github.com/imponeer/object-errors","commit_stats":{"total_commits":66,"total_committers":5,"mean_commits":13.2,"dds":"0.18181818181818177","last_synced_commit":"9a71c196c41a26e8af43770b95a56448d0760143"},"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/imponeer/object-errors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imponeer%2Fobject-errors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imponeer%2Fobject-errors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imponeer%2Fobject-errors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imponeer%2Fobject-errors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/imponeer","download_url":"https://codeload.github.com/imponeer/object-errors/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/imponeer%2Fobject-errors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013413,"owners_count":26085274,"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-10-12T02:00:06.719Z","response_time":53,"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":["errors","hacktoberfest","object","php-library"],"created_at":"2024-11-07T05:38:31.900Z","updated_at":"2025-10-12T23:39:16.691Z","avatar_url":"https://github.com/imponeer.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![License](https://img.shields.io/github/license/imponeer/object-errors.svg?maxAge=2592000)](LICENSE)\n[![Packagist](https://img.shields.io/packagist/v/imponeer/object-errors.svg)](https://packagist.org/packages/imponeer/object-errors) [![PHP](https://img.shields.io/packagist/php-v/imponeer/object-errors.svg)](http://php.net)\n[![Packagist](https://img.shields.io/packagist/dm/imponeer/object-errors.svg)](https://packagist.org/packages/imponeer/object-errors)\n\n# Object Errors\n\nA PHP library for collecting and managing errors associated with objects. Useful for tracking validation or processing errors in a structured way.\n\n## Installation\n\nInstall via [Composer](https://getcomposer.org):\n\n```bash\ncomposer require imponeer/object-errors\n```\n\nAlternatively, you can manually include the files from the `src/` directory.\n\n## Usage\n\nThis library allows you to attach an error collection to your objects and manage errors easily.\n\n### Using as a property\nBelow is a simple usage example by directly creating an `ErrorsCollection` instance:\n\n```php\nuse Imponeer\\ObjectErrors\\ErrorsCollection;\n\nclass MyObject {\n    /**\n     * @var ErrorsCollection|null\n     */\n    public $errors = null;\n\n    public function __construct() {\n        $this-\u003eerrors = new ErrorsCollection();\n    }\n\n    public function doSomething() {\n        // Example logic\n        if ($failed) {\n            $this-\u003eerrors-\u003eadd(\"Some error\");\n        }\n    }\n\n    public function render() {\n        if ($this-\u003eerrors-\u003eisEmpty()) {\n            return 'Everything fine';\n        } else {\n            return $this-\u003eerrors-\u003egetHtml();\n        }\n    }\n}\n```\n\n### Using as a trait\nYou can also use the provided `ErrorsTrait` to quickly add error handling to your classes:\n\n```php\nuse Imponeer\\ObjectErrors\\ErrorsTrait;\n\nclass MyObject {\n    use ErrorsTrait;\n\n    public function doSomething() {\n        if ($failed) {\n            $this-\u003esetErrors(\"Some error\");\n        }\n    }\n\n    public function render() {\n        if ($this-\u003ehasError()) {\n            return $this-\u003egetHtmlErrors();\n        }\n        return 'Everything fine';\n    }\n}\n```\n\n## Development\n\nBelow are useful commands for development. Each command should be run from the project root directory.\n\nRun tests using PHPUnit:\n```bash\ncomposer test\n```\n\nCheck code style using PHP_CodeSniffer:\n```bash\ncomposer phpcs\n```\n\nAutomatically fix code style issues:\n```bash\ncomposer phpcbf\n```\n\nRun static analysis using PHPStan:\n```bash\ncomposer phpstan\n```\n\n## API Documentation\n\nFor detailed API documentation, please visit the [Object Errors Wiki](https://github.com/imponeer/object-errors/wiki).\n\n## How to contribute?\n\nContributions are welcome! If you want to add new features or fix bugs, please fork the repository, make your changes, and submit a pull request.\n\nIf you find any bugs or have questions, please use the [issues tab](https://github.com/imponeer/object-errors/issues) to report them or ask questions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimponeer%2Fobject-errors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fimponeer%2Fobject-errors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fimponeer%2Fobject-errors/lists"}