PHPackages                             sf4/api - 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. sf4/api

ActiveLibrary[API Development](/categories/api)

sf4/api
=======

Simple rest API for Symfony 4

v1.5.13(7y ago)0941MITPHPPHP ~7.1

Since Jan 17Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Sf4/Api)[ Packagist](https://packagist.org/packages/sf4/api)[ Docs](https://github.com/Sf4/Api)[ RSS](/packages/sf4-api/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (11)Versions (72)Used By (1)

Api
===

[](#api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/27f4139132744f6374e0c2bf7883cb309db951282f37f45fee6e1fa6f5fd41ca/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f5366342f4170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Sf4/Api)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/d1e16c817d64b4b9dfd580ff5bfc32c68ebe6c81325105f80c9f8277532997ce/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f5366342f4170692f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/Sf4/Api)[![Coverage Status](https://camo.githubusercontent.com/c895c6d7ec20ac97705c9b5d255cead943fdcc212a52e547ad8cd5e03ae2c12b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f5366342f4170692e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Sf4/Api/code-structure)[![Quality Score](https://camo.githubusercontent.com/aaf530bde47957d2fda567733fd4cc60f0925204d6d5983334afe2d1442556c9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f5366342f4170692e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/Sf4/Api)[![Total Downloads](https://camo.githubusercontent.com/bc29da8efd32948a618ce1df1a1e7e164105b40f44dc568356e05a216f3636e2/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f5366342f4170692e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/Sf4/Api)

Simple rest API for Symfony 4

Structure
---------

[](#structure)

If any of the following are applicable to your project, then the directory structure should follow industry best practices by being named the following.

```
bin/
config/
src/
tests/
vendor/

```

Install
-------

[](#install)

Via Composer

```
$ composer require Sf4/Api
```

Usage
-----

[](#usage)

config/routes.yaml

```
api_default:
    path: /
    methods: [GET, OPTIONS]

api_site:
    path: /site/{token}
    methods: [GET, OPTIONS]

```

config/services.yaml

```
services:
    parameters:
        # ...
        api_token: '%env(resolve:API_TOKEN)%'

#   ...

    Sf4\Api\Services\TagAwareCacheAdapter: ~
    Sf4\Api\Services\CacheAdapterInterface: '@Sf4\Api\Services\TagAwareCacheAdapter'

    Sf4\Api\Repository\RepositoryFactory:
        class: Sf4\Api\Repository\RepositoryFactory
        arguments:
            $entityManager: '@Doctrine\ORM\EntityManagerInterface'
            $entities:      []

    Sf4\Api\EventSubscriber\RequestSubscriber: ~
    Sf4\Api\RequestHandler\RequestHandlerInterface:
        class: Sf4\Api\RequestHandler\RequestHandler
        calls:
            -   method: setEntityManager
                arguments:
                    -   '@Doctrine\ORM\EntityManagerInterface'
            -   method: setTranslator
                arguments:
                    -   '@Symfony\Component\Translation\TranslatorInterface'
            -   method: setDispatcher
                arguments:
                    -   '@Symfony\Component\EventDispatcher\EventDispatcherInterface'
            -   method: setRepositoryFactory
                arguments:
                    -   '@Sf4\Api\Repository\RepositoryFactory'
            -   method: setCacheAdapter
                arguments:
                    -   '@Sf4\Api\Services\CacheAdapterInterface'
            -   method: setSites
                arguments:
                    -
                        -   { site: 'parent', url: null, token: null }
                        # -   { site: 'parent', url: 'parent.example.com', token: 'API_TOKEN' }
                        # -   { site: 'example', url: 'site.example.com', token: 'API_TOKEN' }
            -   method: setAvailableRoutes
                arguments:
                    -   api_default: 'Sf4\Api\Request\DefaultRequest'
                        api_site: 'Sf4\Api\Request\SiteRequest'
```

config/packages/translation.yaml

```
framework:
    # ...
    translator:
        # ...
        paths:
            # ...
            - '%kernel.project_dir%/vendor/sf4/api/src/translations'

```

Testing
-------

[](#testing)

```
$ composer test
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Siim Liimand](https://github.com/siimliimand)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~1 days

Recently: every ~8 days

Total

70

Last Release

2644d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7560943?v=4)[Siim Liimand](/maintainers/siimliimand)[@siimliimand](https://github.com/siimliimand)

---

Top Contributors

[![siimliimand](https://avatars.githubusercontent.com/u/7560943?v=4)](https://github.com/siimliimand "siimliimand (91 commits)")

---

Tags

apisf4

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M378](/packages/easycorp-easyadmin-bundle)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M530](/packages/shopware-core)[chameleon-system/chameleon-base

The Chameleon System core.

1027.9k4](/packages/chameleon-system-chameleon-base)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.8M717](/packages/sylius-sylius)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M473](/packages/pimcore-pimcore)

PHPackages © 2026

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