check24 / apitk-header-bundle
This bundle provides helpful api helpers for RESTful API's
Installs: 4 333
Dependents: 2
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 4
Type:symfony-bundle
Requires
- php: ^8.0
- symfony/config: ^5.3 || ^6.0
- symfony/dependency-injection: ^5.3 || ^6.0
- symfony/http-kernel: ^5.3 || ^6.0
Requires (Dev)
- captainhook/captainhook: ^5.10
- captainhook/plugin-composer: ^5.3
- friendsofphp/php-cs-fixer: ^v3.4
- phpmd/phpmd: ^2.11
- phpstan/phpstan: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.0
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2024-10-05 01:50:15 UTC
README
Overview
This bundle provides useful features for a symfony based RESTful API.
Installation
Install the package via composer:
composer require check24/apitk-header-bundle
Usage
Header information
You can easily add information to the response headers by using the HeaderInformation
service.
These information will automatically be added to the response and prefixed with x-apitk-
public function index(HeaderInformation $headerInformation): array { $users = $this->getUsers(); $headerInformation->add('users-count', (string) count($users)); return $users; }
will result in a response header x-apitk-users-count: 15
.
Deprecations (apitk-deprecation-bundle)
You can mark actions as deprecated so developers can notice that they have to update their API call to a newer version or to use a whole other endpoint.