JSON REST API which is build on top of Symfony framework.
This application is mean to use as an API
that some frontend
application(s) or different backend application(s) uses as they like.
Requirements ᐞ
Docker Engige If you are not using Docker Engine then follow this
Recommendations ᐞ
*nix platform
- most likely you're going to host your application on *nix platform - so I would recommend to do development also on that platform.Makefile
support - if you don't have this you need to lookMakefile
file to see what eachmake
command is doing.
Installation ᐞ
This installation guide expects that you're using Docker Engine.
1. Clone repository ᐞ
Use your favorite IDE and get checkout from GitHub or just use following command
git clone https://github.com/tarlepp/symfony-flex-backend.git
2. Start containers ᐞ
For this just run following command, which will start all the containers:
make start
If you like to start containers in background, then you can use following command:
make daemon
These commands will create following containers to run this backend application:
- php (this is for actual application)
- nginx (this will serve application)
- mariadb (MariaDB 10.7 which will store all the data of application)
- dozzle (to see your docker container logs)
- adminer (to manage your database via browser)
3. Using application ᐞ
By default make start
command starts all the containers and exposes
following ports on localhost
on your host machine:
- symfony-backend-nginx - https://localhost:8000 (nginx)
- PHP-FPM status page - https://localhost:8000/status
- SSL with selfsigned certificates
- symfony-backend-nginx - http://localhost:8080 (nginx)
- PHP-FPM status page - http://localhost:8080/status
- Normal HTTP
- symfony-backend-php-fpm - this is not exposed to host machine (php-fpm)
- symfony-backend-mariadb - http://localhost:33060 (mariadb)
- symfony-backend-dozzle - http://localhost:8100 (dozzle)
- symfony-backend-adminer - http://localhost:8200 (adminer)
And this application is usable within your browser on https://localhost:8000
address. When you first time open that site you will see "Your connection is
not private" warning - see this to resolve that.
Another choice is to use http://localhost:8080
which is not using SSL.
MariaDB credentials:
user: root
password: password
4. Getting shell to container ᐞ
After you've run make start
command you can list all running containers with
docker ps
command.
And to eg. get shell (bash or fish) access inside one of those containers you can run following command:
make bash
OR
make fish
5. Building containers ᐞ
For time to time you probably need to build containers again. This is something that you should do everytime if you have some problems to get containers up and running. This you can do with following command:
make daemon-build
If you like to see containers logs directly use following command:
make start-build
Frontend? ᐞ
So this is an API backend what about frontend then? No worries I've made simple Angular NgRx powered template frontend which work with this backend just out of the box.
Angular NgRx powered frontend template for Symfony backend
With these two template applications it should be quite easy to start to build your own application - right?
Resources ᐞ
- Resource index
- Application commands
- Concepts and features
- Custom configuration
- Development guide
- Installation without docker
- PhpStorm configuration
- Speed problems with Docker Engine?
- Testing guide
- Usage checklist
- Using Xdebug
- Scripts
External links / resources ᐞ
- Symfony Flex set to enable RAD (Rapid Application Development)
- Symfony 4: A quick Demo
- composer-version
- Symfony Recipes Server
Authors ᐞ
License ᐞ
Copyright © 2024 Tarmo Leppänen