friendsofsymfony/rest-bundle
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
psr/log | 3.0.0 | 6.77 kB | MIT | prod dev | |
symfony/config | v6.4.7 | - | MIT | prod dev | |
symfony/dependency-injection | v6.4.7 | - | MIT | prod dev | |
symfony/event-dispatcher | v6.4.7 | - | MIT | prod dev | |
symfony/framework-bundle | v6.4.7 | - | MIT | prod | |
symfony/http-foundation | v6.4.7 | - | MIT | prod dev | |
symfony/http-kernel | v6.4.7 | - | MIT | prod dev | |
symfony/routing | v6.4.7 | - | MIT | prod dev | |
symfony/security-core | v6.4.7 | - | MIT | prod dev | |
willdurand/jsonp-callback-validator | v2.0.0 | 7.82 kB | MIT | prod | |
willdurand/negotiation | 3.1.0 | 26.26 kB | MIT | prod |
The FriendsOfSymfony REST Bundle (FOSRestBundle) is a powerful toolset designed to facilitate the rapid development of RESTful APIs and applications using Symfony. It provides a number of features beneficial to developers: a view layer for output and format-agnostic controllers, handling custom mime types through Accept header format negotiation, RESTful decoding of HTTP request bodies and Accept headers, mapping of exception codes to HTTP response status codes, and serializer error rendering compatible with the RFC 7807 through use of the Symfony Serializer component or the JMS Serializer.
Utilization of the FOSRestBundle begins with installation, for which all necessary instructions are provided in the package's official documentation. Its usage revolves around its primary features. For instance, to create format-agnostic controllers, developers will use the View layer, which can be customized further based on the requirements of your API. Additionally, thanks to intelligent decoder mechanisms, developers can easily interpret HTTP request bodies and Accept headers in RESTful fashion. Exception handling with FOSRestBundle is also simplified, as it performs automatic mapping of exception codes to HTTP response status codes.
This is a simple example in which the FOSRestBundle's View layer is being used:
use FOS\RestBundle\View\View;
use Symfony\Component\HttpFoundation\Response;
public function getFooAction()
{
$data = ... // get data, it can be an array or an object
$view = View::create($data, Response::HTTP_OK);
return $view;
}
For more comprehensive information, including all specifics of the FOSRestBundle's usage, refer to the official documentation. Thorough guidance on everything from simple setup to advanced features is available in the package's dedicated Documentation on the Read the Docs platform.