https://github.com/chubbyphp/chubbyphp-petstore
A simple skeleton to build api's based on the chubbyphp-framework, mezzio (former zend-expressive) or slim.
https://github.com/chubbyphp/chubbyphp-petstore
api boilerplate chubbyphp-framework dbal doctrine mezzio mongodb odm orm skeleton slim-framewok zend-expressive
Last synced: 13 days ago
JSON representation
A simple skeleton to build api's based on the chubbyphp-framework, mezzio (former zend-expressive) or slim.
- Host: GitHub
- URL: https://github.com/chubbyphp/chubbyphp-petstore
- Owner: chubbyphp
- License: mit
- Created: 2018-09-03T10:34:13.000Z (over 7 years ago)
- Default Branch: chubbyphp
- Last Pushed: 2026-01-11T16:16:59.000Z (15 days ago)
- Last Synced: 2026-01-11T18:48:54.431Z (15 days ago)
- Topics: api, boilerplate, chubbyphp-framework, dbal, doctrine, mezzio, mongodb, odm, orm, skeleton, slim-framewok, zend-expressive
- Language: PHP
- Homepage:
- Size: 3.98 MB
- Stars: 38
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# petstore
[](https://github.com/chubbyphp/petstore/actions/workflows/ci.yml)
[](https://coveralls.io/github/chubbyphp/petstore?branch=chubbyphp)
[](https://dashboard.stryker-mutator.io/reports/github.com/chubbyphp/petstore/chubbyphp)
## Description
A simple skeleton to build api's based on the [chubbyphp-framework][1].
## Requirements
* php: ^8.3
* [chubbyphp/chubbyphp-clean-directories][2]: ^1.5
* [chubbyphp/chubbyphp-cors][3]: ^1.7
* [chubbyphp/chubbyphp-decode-encode][4]: ^1.3
* [chubbyphp/chubbyphp-framework][5]: ^6.0
* [chubbyphp/chubbyphp-framework-router-fastroute][6]: ^2.3
* [chubbyphp/chubbyphp-http-exception][7]: ^1.3
* [chubbyphp/chubbyphp-laminas-config][8]: ^1.5
* [chubbyphp/chubbyphp-laminas-config-doctrine][9]: ^3.1
* [chubbyphp/chubbyphp-laminas-config-factory][10]: ^1.5
* [chubbyphp/chubbyphp-negotiation][11]: ^2.3
* [chubbyphp/chubbyphp-parsing][12]: ^2.1
* [doctrine/orm][13]: ^3.5.8
* [monolog/monolog][14]: ^3.9
* [ramsey/uuid][15]: ^4.9.1
* [slim/psr7][16]: ^1.8
* [symfony/console][17]: ^7.4.1|^8.0.1
* [symfony/var-exporter][18]: ^7.4.0
## Environment
Add the following environment variable to your system, for example within `~/.bashrc` or `~/.zshrc`:
```sh
export USER_ID=$(id -u)
export GROUP_ID=$(id -g)
```
Make sure all the mount points are given
```sh
touch ~/.bash_docker
touch ~/.bash_history
```
```sh
touch ~/.gitconfig
touch ~/.gitignore
```
```sh
mkdir -p ~/.local/share/opencode
[ ! -f ~/.local/share/opencode/auth.json ] && echo '{}' > ~/.local/share/opencode/auth.json
```
```sh
touch ~/.zsh_docker
touch ~/.zsh_history
```
### Docker
```sh
docker-compose up -d
docker-compose exec php bash
```
## Setup
```sh
composer install
composer setup:dev
```
## Urls
* GET https://localhost/ping
* GET https://localhost/swagger (https://localhost/openapi)
### Pet
* GET https://localhost/api/pets?sort[name]=asc
* POST https://localhost/api/pets
* GET https://localhost/api/pets/8ba9661b-ba7f-436b-bd25-c0606f911f7d
* PUT https://localhost/api/pets/8ba9661b-ba7f-436b-bd25-c0606f911f7d
* DELETE https://localhost/api/pets/8ba9661b-ba7f-436b-bd25-c0606f911f7d
### DBs
* jdbc:postgresql://localhost:5432/petstore?user=root&password=root
## Structure
### Collection
Collections are sortable, filterable paginated lists of models.
* [App\Collection][60]
### Dto
A DTO, or Data Transfer Object, is a simple object used to transport data between software application components.
* [App\Dto][70]
### Middleware
Middleware functions can execute code, make changes to the request and response objects.
Middleware can generally be added globally or on a per-route basis.
* [App\Middleware][80]
### Model
Models, entities, documents what ever fits your purpose the best.
* [App\Model][90]
### ORM
ORM Mapping definitions.
* [App\ORM][100]
### Parsing
Parses and validates data against predefined schemas, ensuring that incoming data conforms to expected structures and criteria.
* [App\Parsing][110]
### Repository
Repositories get data from storages like databases, elasticsearch, redis or whereever your models are stored or cached.
* [App\Repository][120]
### RequestHandler
RequestHandler alias Controller, or Controller actions to be more precise.
There is a directory with generic crud controllers. If you like the idea adapt them for your generic use case, if not drop them.
I highly recommend to not extend them.
* [App\RequestHandler][130]
### ServiceFactory
Service factories are the glue code of the dependeny injection container.
* [App\ServiceFactory][140]
## Opensearch
### Policy to delete logstash formatted indicies after 14 days.
```.sh
curl -XPUT 'https://admin:98T722Eqw99oqFCSJCnB@localhost:9200/_plugins/_ism/policies/logstash-policy' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"policy": {
"description": "Logstash",
"default_state": "hot",
"states": [
{
"name": "hot",
"actions": [],
"transitions": [
{
"state_name": "delete",
"conditions": {
"min_index_age": "14d"
}
}
]
},
{
"name": "delete",
"actions": [
{
"delete": {}
}
]
}
],
"ism_template": {
"index_patterns" : ["logstash-*"],
"priority": 100
}
}
}' \
--insecure
```
## Copyright
2026 Dominik Zogg
[1]: https://github.com/chubbyphp/chubbyphp-framework
[2]: https://packagist.org/packages/chubbyphp/chubbyphp-clean-directories
[3]: https://packagist.org/packages/chubbyphp/chubbyphp-cors
[4]: https://packagist.org/packages/chubbyphp/chubbyphp-decode-encode
[5]: https://packagist.org/packages/chubbyphp/chubbyphp-framework
[6]: https://packagist.org/packages/chubbyphp/chubbyphp-framework-router-fastroute
[7]: https://packagist.org/packages/chubbyphp/chubbyphp-http-exception
[8]: https://packagist.org/packages/chubbyphp/chubbyphp-laminas-config
[9]: https://packagist.org/packages/chubbyphp/chubbyphp-laminas-config-doctrine
[10]: https://packagist.org/packages/chubbyphp/chubbyphp-laminas-config-factory
[11]: https://packagist.org/packages/chubbyphp/chubbyphp-negotiation
[12]: https://packagist.org/packages/chubbyphp/chubbyphp-parsing
[13]: https://packagist.org/packages/doctrine/orm
[14]: https://packagist.org/packages/monolog/monolog
[15]: https://packagist.org/packages/ramsey/uuid
[16]: https://packagist.org/packages/slim/psr7
[17]: https://packagist.org/packages/symfony/console
[18]: https://packagist.org/packages/symfony/var-exporter
[40]: https://packagist.org/packages/chubbyphp/petstore
[60]: src/Collection
[70]: src/Dto
[80]: src/Middleware
[90]: src/Model
[100]: src/Orm
[110]: src/Parsing
[120]: src/Repository
[130]: src/RequestHandler
[140]: src/ServiceFactory