PHPackages                             arturdoruch/simple-rest-bundle - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. arturdoruch/simple-rest-bundle

ActiveLibrary[HTTP &amp; Networking](/categories/http)

arturdoruch/simple-rest-bundle
==============================

Collection of useful functions for build RESTful API

2.1.0(5y ago)08MITPHPPHP &gt;=7.0CI failing

Since Apr 13Pushed 5y ago1 watchersCompare

[ Source](https://github.com/arturdoruch/simple-rest-bundle)[ Packagist](https://packagist.org/packages/arturdoruch/simple-rest-bundle)[ RSS](/packages/arturdoruch-simple-rest-bundle/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (6)Versions (10)Used By (0)

SimpleRestBundle
================

[](#simplerestbundle)

Symfony bundle with collection of useful functions for build RESTful API.

Installation
------------

[](#installation)

```
composer require arturdoruch/simple-rest-bundle
```

Register bundle in `Kernel` class of your application.

In Symfony 3

```
// app/AppKernel.php
public function registerBundles()
{
    $bundles = [
        new ArturDoruch\SimpleRestBundle\ArturDoruchSimpleRestBundle(),
    ];
```

In Symfony &gt;= 4

```
// config/bundles.php
return [
    // Other bundles
    ArturDoruch\SimpleRestBundle\ArturDoruchSimpleRestBundle::class => ['all' => true],
];
```

### Suggestions

[](#suggestions)

- For serializing and normalizing HTTP response data install the `jms/serializer-bundle` package.
- For translating API error messages install the `symfony/translation` package.

Configuration
-------------

[](#configuration)

Bundle configuration. Available options:

```
artur_doruch_simple_rest:
    # Required. API endpoint paths as regexp.
    api_paths:
        # Example:
        - ^\/product(\/.+)*$
    # Whether to flatten form error messages multidimensional array into simple array
    # with key (form names path) value (messages concatenated with ";") pairs.
    form_error_flatten_messages: true
```

Usage
-----

[](#usage)

### Controller

[](#controller)

In your controller import the `ArturDoruch\SimpleRestBundle\RestTrait` trait to have access to common REST functions.

Examples of handling API requests.

```
