You can create a new project using this skeleton by running the following command:
$>echo n | composer create-project evaneos/silex-rest-skeleton <your-project-name> -s dev
After that, you'll have to:
- Setup git
$>composer git-setup [email protected]:<vendor-name>/<project-name>
You can see all remote via git remote -v
origin target you application repository and upstream the silex skeleton project
- Setup the env for docker
- In
infrastructure/environment/dev/php/config, create yourblackfire-agent.envfile fromblackfire-agent.env.tplto set your blackfire conf. - In
infrastructure/environment/dev/tunnel, create yourdb.envfile fromdb.env.tplto set your ssh tunnel to the DB machine. - Build the docker images:
- Go to
infrastructure/dockerfilesdirectory - Type the following command $>
make build
- Go to
- Run your docker containers:
- Go to
infrastructure/environment\devdirectory - Type the following command $>
docker-compose up -d
- Go to
- To kill your docker containers:
- Go to
infrastructure/environment\devdirectory - Type the following command $>
docker-compose kill - Type the following command $>
docker-compose rm -f
- Go to
- Setup and run your app
- In
config, create yourconfig.ymlfile to setup your app - To access your app via http (if your docker containers are running):
- Type the following command $>
docker ps | grep rest-api-nginxand look for the port in the filed looking like this:0.0.0.0:<your-port>->80tcp - Your app is now accessible at
http://<your-machine-ip>:<your-port>/
- Type the following command $>
- Start coding
- Put your domain code in
src - All the app code will go in
app- Your new Controllers will go in
app/API/Controllersand will be declared in a ServiceProvider - ControllerProviders will go in
app/API/ControllerProvidersand will be declared in a ServiceProvider - Your routes will be mounted through ControllerProviders in
app/Application::mountRoutes - Your API resources will go in
app/API/Resources - Your parameters converters will go in
app/API/Convertersand will be delcared inapp/ServiceProviders/RestAPIServiceProvideror in a new ServiceProvider - Your ServiceProviders will go in
app/ServiceProviders - Your Domain services will be declared in a new ServiceProvider and registered in
app/Application::addDomainServicesor be registered there directly
- Your new Controllers will go in
- Console
At the directory root, you'll find a file named console which will let you launch commands
To add a command:
- Create it in
app/Commands - Add its declaration in
app/ServiceProviders/CommandsServiceProvideror add a new one - Add the command to the application in
app/Application::bootCLI
