evaneos / silex-rest-skeleton
Silex REST skeleton
Installs: 76
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 22
Forks: 2
Open Issues: 4
pkg:composer/evaneos/silex-rest-skeleton
Requires
- php: >=5.5.9
- dflydev/doctrine-orm-service-provider: ^2.0
- doctrine/orm: ^2.5
- evaneos/silex-jwt-provider: ^2.0
- firebase/php-jwt: ^3.0
- hautelook/templated-uri-router: ^2.0
- incenteev/composer-parameter-handler: ~2.0
- jms/serializer: ^1.1.0
- monolog/monolog: ^1.17
- pagerfanta/pagerfanta: ^1.0
- ramsey/uuid: ^3.4
- reva2/config-service-provider: ^2.0
- silex/silex: ^2.0
- symfony/polyfill-php55: ~1.0
- symfony/security: ^3.0
- symfony/validator: ^2.1
- symfony/yaml: ^3.0
- willdurand/hateoas: ^2.8
Requires (Dev)
- behat/behat: ^3.0
- friendsofphp/php-cs-fixer: ^1.10
- phpspec/phpspec: ~2.0
- phpunit/phpunit: ^4.0
- symfony/debug: ^3.0
- symfony/var-dumper: ^3.0
This package is auto-updated.
Last update: 2020-11-03 19:25:00 UTC
README
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 git@github.com:<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