PHPackages                             phphleb/api-multitool - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. phphleb/api-multitool

ActiveLibrary[API Development](/categories/api)

phphleb/api-multitool
=====================

A set of traits for creating an API

v2.0.0(2y ago)02831MITPHPPHP &gt;=7.4.0

Since Oct 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/phphleb/api-multitool)[ Packagist](https://packagist.org/packages/phphleb/api-multitool)[ RSS](/packages/phphleb-api-multitool/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)DependenciesVersions (4)Used By (1)

A set of useful traits for API implementation
=============================================

[](#a-set-of-useful-traits-for-api-implementation)

[![PHP](https://camo.githubusercontent.com/30da60ee026a505924b598ee10e72b4f78c52de0509ddad6d8574eb1b5713b08/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545372e342d626c7565)](https://camo.githubusercontent.com/30da60ee026a505924b598ee10e72b4f78c52de0509ddad6d8574eb1b5713b08/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d253545372e342d626c7565) [![PHP](https://camo.githubusercontent.com/5e499a8b3a08ba57ec0640d128fa33eb8929b78cf02d347df3a93947089cfa1f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382d626c7565)](https://camo.githubusercontent.com/5e499a8b3a08ba57ec0640d128fa33eb8929b78cf02d347df3a93947089cfa1f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382d626c7565) [![License: MIT](https://camo.githubusercontent.com/fdf4c838e998efe42a2cfb3c27b8addedc9f7ddd1ecfecc4b19254f784232b7a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542532302846726565292d627269676874677265656e2e737667)](https://github.com/phphleb/hleb/blob/master/LICENSE)

Can be used either separately or in conjunction with the HLEB2 framework: [github.com/phphleb/hleb](https://github.com/phphleb/hleb)

The set represents independent traits, each of which implements highly specialized methods that are used in controllers.

### Installation

[](#installation)

Using Composer

```
 composer require "phphleb/api-multitool:^2.0"
```

or download the library to the 'vendor/phphleb/api-multitool' folder.

### BaseApiTrait

[](#baseapitrait)

All 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. If another set of these traits is needed, then you need to either use them as a group or combine them into your own set. It 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.

For the HLEB2 framework it might look like this (implementation example):

```
