PHPackages                             smartbox/api-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. [API Development](/categories/api)
4. /
5. smartbox/api-bundle

ActiveSymfony-bundle[API Development](/categories/api)

smartbox/api-bundle
===================

Smartbox Api Bundle

v0.14.0(3y ago)26.4k[1 PRs](https://github.com/smartboxgroup/api-bundle/pulls)MITPHPPHP &gt;=7.0CI failing

Since Mar 20Pushed 3y ago13 watchersCompare

[ Source](https://github.com/smartboxgroup/api-bundle)[ Packagist](https://packagist.org/packages/smartbox/api-bundle)[ RSS](/packages/smartbox-api-bundle/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (4)Dependencies (21)Versions (9)Used By (0)

API bundle
----------

[](#api-bundle)

The API bundle allows you to create REST and SOAP APIs in a seamless way. It also auto generates documentation for both APIs

[![Latest Stable Version](https://camo.githubusercontent.com/168cf960e2b27e9e7f73172defaab76b16bd43cf6e7c6a2d6eec1d650b5b0af7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736d617274626f782f6170692d62756e646c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/smartbox/api-bundle)[![Minimum PHP Version](https://camo.githubusercontent.com/4f932f73805d15db08ccaff5353e0c2529d22df05fd40f8e61bdb4b0a77d9029/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d7e253230372e302d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net/)[![Build Status](https://camo.githubusercontent.com/c9eb7a24ae5a770576ec3e709595565c08210de31c7b79411fa3dd40ec9053b3/68747470733a2f2f7472617669732d63692e636f6d2f736d617274626f7867726f75702f6170692d62756e646c652e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/smartboxgroup/api-bundle)

Installation and usage
----------------------

[](#installation-and-usage)

To install the bundle, you just need to:

1. Add the repository to composer as:

```
   "require": {
     "smartbox/api-bundle": "dev-master"
   }
   "repositories": [
      {
        "type": "vcs",
        "url":  "git@gitlab.production.smartbox.com/:smartesb/api-bundle.git"
      }
    ],

```

2. Add it to your AppKernel.php file
3. Add to your config.yml file: imports:

    - { resource: "@SmartboxApiBundle/Resources/config/config.yml" }
4. Ammend the previous config.yml file to determine your endpoints. You can see the output by running:

```
  php console.php config:dump-reference smartbox-api

```

```
# Default configuration for extension with alias: "smartbox_api"
smartbox_api:

    # Id of user provider service which implements Symfony\Component\Security\Core\User\UserProviderInterface
    #
    #     f.e.: security.user.provider.concrete.in_memory
    #
    userProvider:         ~ # Required
    default_controller:   'SmartboxApiBundle:API:handleCall'

    # Enable/Disable throttling (dafault: false).
    #
    #     If throttling is enabled:
    #         - register bundles in AppKernel.php:
    #             new Noxlogic\RateLimitBundle\NoxlogicRateLimitBundle(),
    #             new Snc\RedisBundle\SncRedisBundle(),
    #         - configure bundles:
    #             noxlogic_rate_limit:
    #                 storage_engine:             redis
    #                 redis_client:               default_client
    #                 rate_response_message:      'You exceeded the rate limit'
    #                 display_headers:            true
    #
    #             snc_redis:
    #                 clients:
    #                     default:
    #                         type: predis
    #                         alias: default
    #                         dsn: redis://localhost
    #
    throttling:           false

    # List of error codes, e.g.::
    #
    #     400: Bad Request, the request could not be understood by the server due to malformed syntax
    #     401: Unauthorized, the request requires user authentication
    #     403: Forbidden, the server understood the request, but is refusing to fulfill it
    #     404: Not Found, the server has not found anything matching the Request-URI
    #     **The success codes can be extended and changed
    errorCodes:           # Required

        # Prototype
        id:                   ~

    # List of success codes, e.g.::
    #
    #     200: Success, the information returned with the response is dependent on the method used in the request
    #     201: Created, the request has been fulfilled and resulted in a new resource being created
    #     202: Accepted, the request has been accepted for processing, but the processing has not been completed
    #     204: No content, the server has fulfilled the request but does not need to return an entity-body
    #     **The success codes can be extended and changed
    successCodes:         # Required

        # Prototype
        id:                   ~

    # List of response codes were the APIBundle should enforce an empty body, e.g.: [301,202]
    restEmptyBodyResponseCodes:  [] # Required
    services:             # Required

        # Prototype
        id:
            parent:               ~
            name:                 ~ # Required
            version:              ~ # Required

            # The SOAP headers namespace need to be defined.
            soapHeadersNamespace:  ~ # Required

            # List of http headers to propagate as SOAP envelope headers in SOAP calls, e.g.::
            #
            #     X-RateLimit-Limit: rateLimitLimit
            #
            #     The headers must be present in order to be propagated. In this example the header is present when activating throttling
            propagateHttpHeadersToSoap:

                # Prototype
                id:                   ~
            removed:              []

            # Endpoint definitions.
            #     Example:
            #     services:
            #         demo_v1:
            #             name: demo
            #             version: v1
            #             methods:
            #
            #             ## BOXES
            #                 createBox:
            #                     description: Creates a box with the given information and returns its id
            #                     successCode: 201
            #                     input:
            #                         box: { type: Smartbox\ApiBundle\Tests\Fixtures\Entity\Box, group: update, mode: body }
            #                     rest:
            #                         route: /box
            #                         httpMethod: POST
            #                     throttling:
            #                         limit: 10
            #                         period: 60
            #
            methods:              # Required

                # Prototype
                name:

                    # Success code to be returned
                    successCode:          200

                    # Description of the method, it will be used in the documentation
                    description:          ~ # Required

                    # Controller to handle the requests to this method
                    controller:           default
                    roles:

                        # Prototype
                        role:                 ~
                    defaults:

                        # Prototype
                        key:                  ~

                    # Section where the input parameters are specified.
                    input:

                        # Prototype
                        name:

                            # The description of the parameter, it will be used in the documentation.
                            description:          ''

                            # The type of the input, it accepts scalar types (integer, double, string), entities (e.g.: MyNamespace\MyEntity) and arrays of them (integer[], MyNamespace\MyEntity[])
                            type:                 ~ # Required

                            # The group of the entity to be used, acts as a view of the entity model, determines the set of attributes to be used.
                            group:                public

                            # Defines if the parameter is a requirement, filter or the body.\nBody: There can be only one input as the body,\n and it must be an Entity or array of entities.\nRequirement: Requirements are scalar parameters which are required.\nFilter: Filters are scalar parameters which are optional.
                            mode:                 requirement

                            # Regex with the format for the parameter, e.g.: d+
                            format:               '[a-zA-Z0-9]+'

                    # Section where the output parameters are specified.
                    output:

                        # The type of the output, it accepts only entities (e.g.: MyNamespace\MyEntity) and arrays of them (MyNamespace\MyEntity[])
                        type:                 ~ # Required

                        # The group of the entity to be used, acts as a view of the entity model, determines the set of attributes to be used.
                        group:                public
                    rest:                 # Required

                        # Route for the this API method
                        route:                ~ # Required

                        # HTTP verb for this API method
                        httpMethod:           ~ # Required

                    # Throttling works only when smartbox_api.throttling is set to true.
                    #
                    #     Response headers:
                    #         X-RateLimit-Limit:          Limit of requests in a time window
                    #         X-RateLimit-Remaining:      Remaining requests in a time window
                    #         X-RateLimit-Reset:          The remaining window before the rate limit resets in UTC epoch seconds
                    #     Response status code when limit is exceeded: 429 Too Many Requests
                    #
                    throttling:

                        # Set limit of requests in specified period.
                        limit:                ~ # Required

                        # Set period to limit requests.
                        period:               ~ # Required

```

5. Add to your routing.yml file:

```
  smartbox_api:
      resource: "@SmartboxApiBundle/Resources/config/routing.yml"
      prefix:   /api

```

6. Create your own bundle
7. Create a controller class extending from APIController like:

```
  class APIController extends \Smartbox\ApiBundle\Controller\APIController
  {
      public function handleCallAction($serviceId, $serviceName, $methodConfig, $version, $methodName, $input)
      {

        // Checks authorization
        $this->checkAuthorization();

        // Check input
        $inputsConfig = $methodConfig['input'];
        $this->checkInput($version, $inputsConfig, $input);

        return $this->respond($response);
    }
  }

```

Tools
-----

[](#tools)

### smartbox:api:generateSDK

[](#smartboxapigeneratesdk)

Generate SDK for a given API.

**Usage:** `php app/console smartbox:api:generateSDK --help`

### smartbox:api:export-list

[](#smartboxapiexport-list)

Exports api and flows list into csv files. By default will be exported to /tmp

**Usage:** `php app/console smartbox:api:export-list --help"`

**Examples:**

- `php app/console smartbox:api:export-list --export-dir "/tmp"`
- `php app/console smartbox:api:export-list --async false --http-method GET`
- `php app/console smartbox:api:export-list --async false --role ROLE_USER`

### smartbox:api:generate-soapui

[](#smartboxapigenerate-soapui)

Generate a sample SoapUI project for a flow, using the api defined in a YAML test file.

**Usage:** `php app/console smartbox:api:generate-soapui --help`

**Examples:**

- `php app/console smartbox:api:generate-soapui -f \"Product/sendProductInformation\" -p ganesh-tt-one17.smartbox-test.local"`

### smartbox:api:dumpPrintable

[](#smartboxapidumpprintable)

Dump the api documentation as a printable html file.

**Usage:** `php app/console smartbox:api:dumpPrintable`

Contributing
------------

[](#contributing)

1. Fork it!
2. Create your feature branch: `git checkout -b my-new-feature`
3. Commit your changes: `git commit -am 'Add some feature'`
4. Push to the branch: `git push origin my-new-feature`
5. Submit a pull request :D

Tests
-----

[](#tests)

Check out the small test app within Tests/Fixtures/

History
-------

[](#history)

v0.1.0: fixed small bug in ApiConfigurator v0.1.1: fixed small typo in template folder name for documentation v0.1.2: improvement for the documentation template for SOAP calls v0.1.3: added missing entity Ok v0.1.4: Improved support for arrays of entities as attribute of another entity v0.1.5: Readme.md file creation v0.1.6: Added WSI compliance v0.1.7: Removed exception handling for non rest calls v0.1.8: Added throttling v0.1.9: Added header propagation to SOAP

Contributors
------------

[](#contributors)

Jose Rufino, Marcin Skurski, Luciano Mammino, Alberto Rodrigo

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~347 days

Total

4

Last Release

1208d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/44230523?v=4)[sbx-integrations](/maintainers/sbx-integrations)[@sbx-integrations](https://github.com/sbx-integrations)

---

Top Contributors

[![Thevart](https://avatars.githubusercontent.com/u/3297319?v=4)](https://github.com/Thevart "Thevart (77 commits)")[![jbaquero](https://avatars.githubusercontent.com/u/4661531?v=4)](https://github.com/jbaquero "jbaquero (71 commits)")[![campru](https://avatars.githubusercontent.com/u/4568007?v=4)](https://github.com/campru "campru (65 commits)")[![mskurski](https://avatars.githubusercontent.com/u/3276138?v=4)](https://github.com/mskurski "mskurski (56 commits)")[![BertrandF23](https://avatars.githubusercontent.com/u/16890058?v=4)](https://github.com/BertrandF23 "BertrandF23 (44 commits)")[![melmccann](https://avatars.githubusercontent.com/u/17508923?v=4)](https://github.com/melmccann "melmccann (36 commits)")[![andreskrey](https://avatars.githubusercontent.com/u/8786949?v=4)](https://github.com/andreskrey "andreskrey (33 commits)")[![andreymor](https://avatars.githubusercontent.com/u/4126694?v=4)](https://github.com/andreymor "andreymor (16 commits)")[![jams246](https://avatars.githubusercontent.com/u/56314366?v=4)](https://github.com/jams246 "jams246 (4 commits)")[![jpjoao](https://avatars.githubusercontent.com/u/3832326?v=4)](https://github.com/jpjoao "jpjoao (2 commits)")[![lmammino](https://avatars.githubusercontent.com/u/205629?v=4)](https://github.com/lmammino "lmammino (1 commits)")[![denis-rendler-evozon](https://avatars.githubusercontent.com/u/17849455?v=4)](https://github.com/denis-rendler-evozon "denis-rendler-evozon (1 commits)")

### Embed Badge

![Health badge](/badges/smartbox-api-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/smartbox-api-bundle/health.svg)](https://phpackages.com/packages/smartbox-api-bundle)
```

###  Alternatives

[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[claroline/core-bundle

Claroline core bundle

165.5k52](/packages/claroline-core-bundle)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
