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

ActiveLibrary[API Development](/categories/api)

zeppaman/api-farm
=================

ApiFarm Core bundles. User zeppaman/api-farm-skeleton for creating a project

4212PHP

Since Mar 15Pushed 5y ago1 watchersCompare

[ Source](https://github.com/zeppaman/api-farm)[ Packagist](https://packagist.org/packages/zeppaman/api-farm)[ RSS](/packages/zeppaman-api-farm/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

API FARM
========

[](#api-farm)

Api Farm is a low code platform based on Symfony and MongoDB. It support out of the box:

- Data management
- Rest API
- User management
- Oaut2 authentication (as standalone server, or JWT resource server)
- OpenID connect support
- Command line automation
- GrapQL with query and mutations
- Dynamic endpoint generation

Install options
===============

[](#install-options)

The recommended deployments is to use the skeleton project, by the way you can add this bundle to your app or run this bundle directly.

Using the skeleton
------------------

[](#using-the-skeleton)

```
# create a project
COMPOSER_MEMORY_LIMIT=-1 composer create-project zeppaman/api-farm my-project

cd my-project

docker-compose up

# configure the application
docker-compose exec app ./vendor/bin/apifarm-install apifarm:config [--db-host DB-HOST] [--db-port DB-PORT] [--db-password DB-PASSWORD] [--db-user DB-USER]

# install the database
docker-compose exec app  bin/console apifarm:install [--adminuser ADMINUSER] [--adminpassword ADMINPASSWORD] [--db-host DB-HOST] [--db-port DB-PORT] [--db-password DB-PASSWORD] [--db-user DB-USER]
```

Manual install
==============

[](#manual-install)

```
composer require zeppaman/api-farm
```

1. Enable the core bundles in bundles.php

    ```
    ApiFarm\CoreBundle\CoreBundle::class => ['all' => true],
    ApiFarm\UiBundle\UiBundle::class => ['all' => true],
    ```
2. Configure the yaml files by running

    ```
    ./vendor/bin/apifarm-install apifarm:config [--db-host DB-HOST] [--db-port DB-PORT] [--db-password DB-PASSWORD] [--db-user DB-USER]
    ```

    This command will create api-farm settings files and will replace the generated files from `lexik_jwt_authentication` `trikoder_oauth2`. The file, if present are renamed `.old` so that you could merge them manually. The command creates the connection string. Now ApiFarm is ready to go!
3. Run `bin/console asset:install --symlink --relative public` for installing assets
4. Run the installation process

    ```
     bin/console apifarm:install [--adminuser ADMINUSER] [--adminpassword ADMINPASSWORD]
    ```

    This command will:

    - create an admin username
    - generate a key pair used for JWT
    - create the config.json file that contains the ui module registrations
    - populate data with a sample collection schema
5. Configure the server for serving the app. The `/bundles/core/` routes have to be served from `/bundles/core/index.html`. The following .htaccess have to be placed into your `public` folder (if you use apache!)

    ```
    RewriteEngine on

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^bundles/core/(.*)$ /bundles/core/index.html [NC,L,QSA]
    ```

Run this bundle.
----------------

[](#run-this-bundle)

This bundle is standalone for development and testing purpose.

Just clone and run it

```
git clone https://github.com/zeppaman/API-Farm.git .
docker-compose up
```

Then you can follow the installation steps using `apifarm-install`

```
# configure the application
docker-compose exec app ./bundles/InstallBundle/bin/apifarm-install apifarm:config [--db-host DB-HOST] [--db-port DB-PORT] [--db-password DB-PASSWORD] [--db-user DB-USER]

# install the database
docker-compose exec app  bin/console apifarm:install [--adminuser ADMINUSER] [--adminpassword ADMINPASSWORD] [--db-host DB-HOST] [--db-port DB-PORT] [--db-password DB-PASSWORD] [--db-user DB-USER]
```

API Usage
=========

[](#api-usage)

In this section we will see how to use API Farm.

Console commands
----------------

[](#console-commands)

```
bin/console app:crud:upsert db collection {\"filed\":\"value\"}
bin/console app:crud:find db collection {\"filed\":\"value\"}
bin/console app:crud:delete db collection {\"filed\":\"value\"}
```

curl --location --request POST '[http://localhost/api/data/test/\_schemas](http://localhost/api/data/test/_schemas)'
\--header 'Content-Type: text/plain'
\--data-raw

Api REST
--------

[](#api-rest)

It uses the resouce URI pattern.

**Collection methods**

- GET `http://localhost/api/{db}/{collection}` + GET for list,
- POST `http://localhost/api/{db}/{collection}` list,

**item methods**

- GET `http://localhost/api/{db}/{collection}/{id}` replace the object,
- PUT `http://localhost/api/{db}/{collection}/{id}` replace the object,
- PATCH `http://localhost/api/{db}/{collection}/{id}` pathc the object,
- DELETE `http://localhost/api/{db}/{collection}/{id}` delete the object,

### find

[](#find)

[http://localhost/api/data/test/prova?skip=10&amp;limit=20&amp;query={%22title%22:%22value%22}](http://localhost/api/data/test/prova?skip=10&limit=20&query=%7B%22title%22:%22value%22%7D)

```
{"request":{"database":"test","collection":"test","skip":"10","limit":"20","query":"{}"},"data":[{"_id":"604335dcddfd8c484b4da692","title":"mytitle","body":"mybody"},{"_id":"604335ea05dcae70fe1ed752","title":"mytitle","body":"mybody"},{"_id":"604335f88288e669541ccb72","title":"mytitle","body":"mybody"},{"_id":"6043363cf9265b45a810f262","title":"mytitle","body":"mybody"},{"_id":"60433646825e954b41534232","title":"mytitle","body":"mybody"},{"_id":"6043368e22619b6cd151d852","title":"mytitle","body":"mybody"},{"_id":"6043369ca48c2a285d4682f2","title":"mytitle","body":"mybody"},{"_id":"604336f26e205328b82ddd32","title":"mytitle","body":"mybody"},{"_id":"6043370630658259257fd982","title":"mytitle","body":"mybody"},{"_id":"60433722f915fc6ba00f5292","title":"mytitle","body":"mybody"},{"_id":"6043387ef42a7a265a743c02","filed":"value"}],"metadata":[]}

```

### GET

[](#get)

```
{"request":{"database":"test","collection":"test","id":"60428383bdb90439ec593df2"},"data":{"_id":"60428383bdb90439ec593df2","ddd":"ddd"},"metadata":[]}

```

OAUTH2
======

[](#oauth2)

Generate a client
-----------------

[](#generate-a-client)

```
 bin/console trikoder:oauth2:create-client

 --------
  Identifier                         Secret
 ---------------------------------- ----------------------------------------------------------------------------------------------------------------------------------
  c0a71bf0379c66c46da3ed41a4f4aab2   e8f9855c30bb9915e61bc093656e75c7e8e3bc3b221eca2be796790af96e6f347b738a28c84ffb9db61617e812b21c51c8b29d9d8d1c92d2df9b386a2404c394
 ---------------------------------- ----------------------------------------------------------------------------------------------------------------------------------
```

Update a client
---------------

[](#update-a-client)

```
bin/console trikoder:oauth2:update-client --grant-type client_credentials --grant-type password c0a71bf0379c66c46da3ed41a4f4aab2
```

List client
-----------

[](#list-client)

```
bin/console trikoder:oauth2:list-clients
```

Get token
---------

[](#get-token)

Using a token with password protocol:

```
curl --location --request POST 'localhost/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=bob' \
--data-urlencode 'password=xyz' \
--data-urlencode 'client_id=c0a71bf0379c66c46da3ed41a4f4aab2' \
--data-urlencode 'client_secret=e8f9855c30bb9915e61bc093656e75c7e8e3bc3b221eca2be796790af96e6f347b738a28c84ffb9db61617e812b21c51c8b29d9d8d1c92d2df9b386a2404c394'
```

Get User Into
-------------

[](#get-user-into)

Userinfo is availabel at `localhost/userinfo`.

```
curl --location --request GET 'localhost/userinfo' --header 'Authorization: Bearer {token}'

{

    "_id": "6043d6703e01b17faf118b53",
    "username": "bob",
    "nome": "Bobby"
     /* any data here*/
}
```

GraphQL
=======

[](#graphql)

Endpoint is located at `localhost/api/graph/{db}`

```
query {
  entity1{
      _id,
      title,
      amount
  }
}
```

```
{
    "data": {
        "entity1": [
            {
                "_id": "6045038ae0c6cde18c3c93bf",
                "title": "test data",
                "amount": 1000
            }
        ]
    }
}
```

Code lambda
===========

[](#code-lambda)

Endpoint is located at `localhost/api/do/{db}/{action}/`

```
curl --location --request GET 'localhost/api/do/{db}/{action}/'

{
    "_id" : ObjectId("60452b54200a9b44267324e8"),
    "name" : "test2",
    "code" : "return $container['crud']->find('test','_mutations',[],1,10);"
}
```

Setup &amp; Testing
===================

[](#setup--testing)

```
#create the client oauht2
docker-compose exec app bin/console trikoder:oauth2:create-client --grant-type password c0a71bf0379c66c46da3ed41a4f4aab2

docker-compose exec app bin/console  app:crud:upsert test "_users" '{"username":"admin","newpassword":"password"}'
#create an entity with fields title and amount
docker-compose exec app bin/console  app:crud:upsert test '_schemas' '{ "name" : "entity1","db" :"test","fields":{"title":{"type": "text",            "name" : "title","label" : "Title"},"amount" : {"type" : "int", "name" : "amount","label" : "Amount"}}}'

#get token
curl --location --request POST 'localhost/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'username=admin' \
--data-urlencode 'password=password' \
--data-urlencode 'client_id={replace}' \
--data-urlencode 'client_secret={replace}'

# enter data
docker-compose exec app bin/console  app:crud:upsert test "entity1" '{"title":"title 1","amount":100}'
docker-compose exec app bin/console  app:crud:upsert test "entity1" '{"title":"title 2","amount":101}'
docker-compose exec app bin/console  app:crud:upsert test "entity1" '{"title":"title 3","amount":102}'
docker-compose exec app bin/console  app:crud:upsert test "entity1" '{"title":"title 4","amount":103}'

#get data GraphQL
curl --location --request GET 'localhost/api/graph/test' --header 'Content-Type: application/json' --data-raw '{"query":"query { \r\n  entity1{\r\n      _id,\r\n      title,\r\n      amount\r\n  }\r\n}","variables":{}}'

curl --location --request GET 'http://localhost/api/data/test/entity1' \
--header 'Authorization: Bearer {token}'
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5618315?v=4)[Daniele Fontani](/maintainers/zeppaman)[@zeppaman](https://github.com/zeppaman)

---

Top Contributors

[![zeppaman](https://avatars.githubusercontent.com/u/5618315?v=4)](https://github.com/zeppaman "zeppaman (9 commits)")

---

Tags

api-platformgraphqlmongodbphpsymfony

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

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