The Leankoala LeanApiBundle is the foundation for using Symfony as restful API.
- CORS Listener - this component handles the mandatory CORS headers. These are mandatory if the API should be accessible from a browser.
- ApiRequest - The API request handles the parameters within the HTTP request body. It also validates and casts the parameters like the Symfony ParamConverter.
The first steps explain how the LeanApiBundle gets installed and how the request data can be processed.
The LeanApiBundle can be installed via composer.
$ composer require leankoala/leanapibundle
Afterwards add the bundle in the AppKernel.php
.
$bundles = [
...
new LeankoalaLeanApiBundle(),
...
]
$apiRequest = new ApiRequest(
$symfonyRequest,
$doctrine,
$schema
);
The API bundle already does a lot but there are still a lot of things we want it to do additionally. This is a list of ideas:
- Auto-generate markdown from the schema arrays
- Use
@annotations
to inject theApiRequest
object with the correct schema - Schema as yml