{"id":20235334,"url":"https://github.com/phphleb/api-multitool","last_synced_at":"2025-07-21T16:33:02.193Z","repository":{"id":60978310,"uuid":"547249316","full_name":"phphleb/api-multitool","owner":"phphleb","description":" A set of traits for creating an API","archived":false,"fork":false,"pushed_at":"2024-01-30T19:22:33.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T19:13:36.976Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"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/phphleb.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}},"created_at":"2022-10-07T11:25:32.000Z","updated_at":"2024-01-29T15:28:08.000Z","dependencies_parsed_at":"2024-01-30T20:54:21.952Z","dependency_job_id":null,"html_url":"https://github.com/phphleb/api-multitool","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"967546a7beb1322bb9b4b55dd06c75e85c1f7aa4"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/phphleb/api-multitool","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phphleb%2Fapi-multitool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phphleb%2Fapi-multitool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phphleb%2Fapi-multitool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phphleb%2Fapi-multitool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phphleb","download_url":"https://codeload.github.com/phphleb/api-multitool/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phphleb%2Fapi-multitool/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266304123,"owners_count":23908381,"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-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":"2024-11-14T08:15:56.136Z","updated_at":"2025-07-21T16:33:02.164Z","avatar_url":"https://github.com/phphleb.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"A set of useful traits for API implementation\n=====================\n\n![PHP](https://img.shields.io/badge/PHP-^7.4-blue) ![PHP](https://img.shields.io/badge/PHP-8-blue) [![License: MIT](https://img.shields.io/badge/License-MIT%20(Free)-brightgreen.svg)](https://github.com/phphleb/hleb/blob/master/LICENSE)\n\nCan be used either separately or in conjunction with the HLEB2 framework: [github.com/phphleb/hleb](https://github.com/phphleb/hleb) \n\nThe set represents independent traits, each of which implements highly specialized methods that are used in controllers.\n\n### Installation\n\nUsing Composer\n ```bash\n  composer require \"phphleb/api-multitool:^2.0\"\n ```\nor download the library to the 'vendor/phphleb/api-multitool' folder.\n\n ### BaseApiTrait\n\nAll auxiliary traits are collected in the trait **BaseApiTrait** as a set. Therefore, it is enough to connect it to the controller and get a complete implementation.\nIf another set of these traits is needed, then you need to either use them as a group or combine them into your own set.\nIt is best to include such a trait in the parent class of controllers that implement the API, so as not to have to do this for everyone.\n\nFor the HLEB2 framework it might look like this (implementation example):\n\n```php\n\u003c?php\n// File /app/Controllers/Api/BaseApiActions.php\n\nnamespace App\\Controllers\\Api;\n\nuse Hleb\\Base\\Controller;\nuse Phphleb\\ApiMultitool\\BaseApiTrait;\n\nclass BaseApiActions extends Controller\n{\n    // Adding a set of traits for the API.\n    use BaseApiTrait;\n\n    function __construct(array $config = [])\n    {\n        parent::__construct($config);\n\n        // Passing the debug mode value to the API constructor.\n        $this-\u003esetApiBoxDebug($this-\u003econtainer-\u003esettings()-\u003eisDebug());\n    }\n}\n\n```\nAfter this, all controllers inheriting from this class will have methods from each trait in the set.\n\nMore details can be found in the [**framework documentation**](https://hleb2framework.ru).\n\n### Testing\n\nAPI traits tested using [github.com/phphleb/api-tests](https://github.com/phphleb/api-tests)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphphleb%2Fapi-multitool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphphleb%2Fapi-multitool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphphleb%2Fapi-multitool/lists"}