A PHP boilerplate for create simple API without the needing of extra bloat
- No framework but only needed
- PHP as an Apache module
- MariaDb/MySql database integration
- Propel ORM for model creation
- Api-Key authentication
- Docker Swarm ready with secrets *_FILE env variables
- Install Docker
- Build development environment
# Setup your environment stuff in docker-compose.yml file than
docker-compose build
sh scripts/composer.sh install
docker-compose up
- Start coding
sh scripts/composer.sh COMPOSER_COMMAND
I use Propel ORM, it's fairly simple to use once you setup it (hopefully this template get the job done).
# Start environment
docker-compose up
# Define your database structure (MySql or MariaDb) in `schema.xml`
# Create the db import structure
mkdir sql && sh scripts/propel.sh sql:build
# Insert the new structure to the actual database
sh scripts/propel.sh sql:insert
# Build PHP model upon structure
sh scripts/propel.sh build
# Start environment
docker-compose up
sh scripts/propel.sh sql:insert
sh scripts/propel.sh migrate
# Start environment
docker-compose up
# Change your schema accordingly than
# Create a migration file for updating production stuff
sh scripts/propel.sh diff
# Build updated models
sh scripts/propel.sh build
# Update db structure
sh scripts/propel.sh migrate
# If something goes wrong after migration or you unsatistied with it
sh scripts/propel.sh migration:down # As many time as you want
- Write production stuff readme
- APCU stuff for production environment
- Make possible to use a db connection string for remote connections