tarlepp/symfony-flex-backend
حول
مشروع قالب لواجهة REST API باستخدام Symfony Flex
تطوير الويب والتطبيقاتالنمو المقاس للنجوم
- خلال 24 ساعة
- ٠
- خلال 7 أيام
- ٠
- خلال 15 يومًا
- ٠
- خلال شهر
- جارٍ جمع السجل
تغيّر صافي النجوم خلال فترات متداخلة، وليس مجموعًا يوميًا. تبقى القياسات المفقودة فارغة. النجوم تقيس الاهتمام لا جودة البرمجيات.
README.md
الأصلWhat is this?
JSON REST API which is built on top of Symfony framework.
This application is meant to be used as an API that frontend applications or
different backend applications can use as needed. One example frontend is
this Angular template, though
you can use any frontend solution.
Table of Contents ᐞ
- What is this
Quick Start ᐞ
git clone https://github.com/tarlepp/symfony-flex-backend.git
cd symfony-flex-backend
make start
Then open https://localhost:8000 in your browser. For more details, see
Installation.
Requirements ᐞ
- Docker Engine
- Docker Compose v2 (included with Docker Desktop)
Standalone installation is not currently maintained; see the standalone installation status before attempting to run without Docker.
Docker images are multi-platform, so the same setup works natively on x86-64
(linux/amd64) and ARM (linux/arm64, e.g. Apple Silicon) hosts. See
Docker multi-platform images for details.
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.WSL2 on Windows- if you develop on Windows, use WSL2 to get a Linux-like development environment for Docker and tooling.Dev Container capable IDE- recommended for the quickest setup (e.g. VS Code or JetBrains IDEs with Dev Container support).Makefilesupport - recommended if you run containers with Make commands; if you do not havemake, checkMakefileto see equivalent Docker commands.
Installation ᐞ
This installation guide expects that you're using Docker Engine.
1. Clone repository ᐞ
Use your favorite IDE and check out the repository from GitHub, or use the following command:
git clone https://github.com/tarlepp/symfony-flex-backend.git
2. Start containers ᐞ
You can run this project either with Dev Containers (for example in VS Code or JetBrains IDEs) or with Make commands.
For Dev Containers, open this repository in your IDE and use its Dev Container workflow to reopen/start the project in a container (see Dev Containers section for details).
If you want to use Make commands instead, run the following command, which will start all the containers:
make start
If you want to start containers in the background, use the following command:
make daemon
To run the production PHP image locally instead, stop development first and start local production mode:
make stop
make daemon-prod
Use make start-prod for foreground logs. Local production serves HTTP at
http://localhost:8001 and reuses the development database, including running
migrations. It requires Docker Compose 2.24.4 or newer. See
Running production locally
for configuration, limitations and switching back to development.
These commands will create following containers to run this backend application:
- php (this is for actual application)
- nginx (this will serve application)
- mariadb (stores application data; see the pinned version in its Dockerfile)
- dozzle (to see your docker container logs)
- adminer (to manage your database via browser)
For next steps (application URLs, shell access, and rebuilding containers), see Running the application.
Running the application ᐞ
These instructions are shared for both Make-based and Dev Container-based workflows.
Using application ᐞ
When containers are running (either via Make commands or Dev Containers),
following ports are exposed on localhost on your host machine:
- symfony-backend-nginx - https://localhost:8000 (nginx)
- PHP-FPM status page - https://localhost:8000/status
- SSL with self-signed 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 -
localhost:33060(mariadb) - symfony-backend-dozzle - http://localhost:8100 (dozzle)
- symfony-backend-adminer - http://localhost:8200 (adminer)
And this application is usable in your browser at https://localhost:8000. When
you open that site for the first time, you will see a "Your connection is not
private" warning - see this to resolve that.
Another choice is to use http://localhost:8080, which does not use SSL.
MariaDB credentials:
user: root
password: password
Note: These credentials are for local development only and should never be used in production.
Getting shell to container ᐞ
After you've started containers (make start / make daemon or via Dev
Containers), you can list all running containers with docker ps.
To get shell (bash or fish) access inside one of those containers, run the following command:
make bash
or
make fish
If you are using Dev Containers, you can also use the IDE terminal that is
already attached to the php container.
Building containers ᐞ
From time to time you probably need to build containers again. This is something that you should do every time if you have some problems getting containers up and running.
If you use Make commands, rebuild/start containers with:
make daemon-build
If you want to see container logs directly, use the following command:
make start-build
If you use Dev Containers, use your IDE's Dev Container rebuild action (for example, "Rebuild Container" / "Rebuild and Reopen in Container").
If you prefer CLI, you can rebuild with:
docker compose -f compose.yaml -f .devcontainer/docker-compose.devcontainer.yml build
docker compose -f compose.yaml -f .devcontainer/docker-compose.devcontainer.yml up -d php mariadb nginx dozzle adminer
Containers are built for your host platform automatically. For building images
for another platform (for example linux/arm64 on an x86-64 host) or updating
pinned base image digests, see Docker multi-platform images.
Health check ᐞ
To verify your setup is working correctly, you can check:
# Check container status
docker compose ps
# Test HTTP endpoint
curl -I http://localhost:8080
# Test HTTPS endpoint (ignore SSL warning)
curl -k -I https://localhost:8000
Alternatively, you can use Dozzle (container log viewer) to monitor all services:
- Open http://localhost:8100 in your browser
- View real-time logs for all running containers
- Check container status and resource usage
Dev Containers ᐞ
This project also includes a Dev Container setup in .devcontainer/ that can be
used from VS Code and JetBrains IDEs with Dev Container support.
When you reopen the repository in a container, it starts the full Docker Compose stack:
phpnginxmariadbdozzleadminer
For application URLs, shell access, and rebuild commands, see Running the application.
For detailed usage, UID/GID notes, and port mappings, see
.devcontainer/README.md.
AI-assisted development ᐞ
New to the project agents and skills? Start with the visual introduction for roles, approval steps, repair, conflict and CVE flows, and practical skill selection.
If you use AI assistance in this repository, use this canonical inventory and reading order for its guidance:
doc/AI_AGENTS_AND_SKILLS.mdfor a contributor-friendly overview with interaction diagramsAGENTS.mdfor agent-specific instructions.github/copilot-instructions.mdas the Copilot entry point to actionable repository instructionsCLAUDE.mdfor architecture and workflow contextdoc/AI_RULES.mdfor AI guidance maintenance.github/skills/README.mdfor task workflowsdoc/FEATURE_AGENTS.mdfor the feature lead, architect, implementer, verifier, conflict-resolver, and cve-fixer workflow and client requirements.github/pull_request_template.mdfor the human review checklist when preparing pull requests
This is a reading order, not a precedence rule: platform instructions apply first, and the implementation, tests, configuration, and CI remain the source of truth for current behavior. See the documentation ownership map for where each kind of guidance is maintained.
As a simple rule of thumb, update the AI guidance when the same review comment, architectural correction, or project convention appears repeatedly and should become a repository default.
For local pre-PR validation, run this from the repository root on the Docker host with the development services running:
make pre-pr-checks
This selects checks from the committed BASE_SHA...HEAD_SHA range, defaulting
to HEAD^ and HEAD; uncommitted changes are excluded. Empty or uncertain
comparisons run all local checks. Use make pre-pr-checks-all to always run
every locally reproducible check.
Run the all-checks target from the same host terminal:
make pre-pr-checks-all
Either target can overwrite generated test/report files. The all-checks target
always builds both image targets; selected mode builds them when the Docker
category is selected. Image builds overwrite the local
symfony-flex-backend:pre-pr-development and
symfony-flex-backend:pre-pr-production tags and require Docker Buildx and
registry access.
GitHub-hosted checks, including Dependency Review, the Symfony Security Checker action, Gitleaks, Trivy scans/SARIF uploads, and optional external reporting, remain part of hosted CI. Scheduled and informational jobs are excluded. For task-scoped validation, follow AGENTS.md and the testing guide.
Continuous integration ᐞ
GitHub Actions runs linting, static analysis, PHPUnit and Docker builds, with
reduced checks for Markdown-only PRs and no repeat core validation for
title/body-only PR edits. Validate CI result and dependency-review are the
required checks. See the workflow guide and execution graphs,
required checks and branch protection, and the
contributor CI guide.
The Coveralls, CodeClimate and SonarCloud badges come from external services.
GitHub Actions uploads reports only to Coveralls and SonarCloud on all PRs and
successful pushes to master, after both tests and ci-summary succeed. Each
upload requires its optional token; upload errors fail the reporting job.
Eligible external reporting must succeed for Validate CI result to pass; it
does not need a separate required-check entry. Fork PRs run the job without
repository secrets and skip uploads. Markdown-only PRs skip reporting because
tests and artifacts are skipped. The CI and OpenSSF Scorecard badges reflect
GitHub-hosted checks.
Frontend? ᐞ
This backend API can be consumed by any frontend technology or framework. You can use React, Vue, Angular, Svelte, or any other frontend solution that can make HTTP requests.
As a reference example, I've created an Angular NgRx powered frontend template project that works with this backend. It demonstrates how to integrate with this API, but you're free to use any technology stack that fits your project needs.
With this backend, it should be quite easy to start building your own application with the frontend technology of your choice.
Resources ᐞ
- Resource index
- AI-assisted change policy
- Application commands
- GitHub workflows and execution graphs
- Required checks and branch protection
- Security policy
- GitHub Actions update guide
- Concepts and features
- Custom configuration
- Development guide
- Docker multi-platform images
- Event listeners and subscribers
- 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
استكشف مشاريع مشابهة ومرتبطة
جارٍ التحميل…