Architecture with Symfony and API Platform 
This architecture is based on Symfony and API Platform, with centralized entity management and access control handled via annotations. All business logic and specific processing are delegated to services (including Providers and Processors). Controllers are only used for specific cases, such as PDF generation.
Technologies Used 
- Symfony: A structured PHP framework based on the MVC architecture.
- API Platform: Automatically generates REST and GraphQL APIs.
- Doctrine ORM: Manages entities and interactions with PostgreSQL.
- JWT Authentication: Secures API endpoints using JSON Web Tokens.
Architecture Structure 
The application is built around three main components:
1. Entities & Security (Access Control via Annotations) 
Role: Define the data structure and enforce access rules through annotations.
Characteristics:
- Entities represent database tables (Doctrine ORM).
- API Platform automatically generates API endpoints.
- Security is managed via annotations in entities: - #[ApiResource(security: "is_granted('ROLE_ADMIN')")]
- #[ApiProperty(readable: false, writable: true)]
 
Examples:
- Userentity with restricted access to personal data.
- Projectentity editable only to authorized users.
2. Services (Providers, Processors & Others) 
Role: Centralize business logic and specific processing.
Providers (Data Providers) 
- Modify how entity data is retrieved.
- Replace repositories to provide enriched data.
Example:
- UserProviderfilters users based on their validation status and roles.
Processors (Data Processors) 
- Handle pre-processing before storing data (POST, PUT, DELETE).
- Used for operations like password hashing or sending notifications.
Example:
- UserProcessorhashes the password before saving the user.
Other Services 
- Encapsulate business logic independent of entities.
- Can be called by Providers and Processors.
Examples:
- AuthServicefor JWT management.
- PDFServicefor generating server-side documents.
- ExternalApiServicefor interacting with external APIs.
3. Routes / Controllers / Views (Specific Use Cases) 
Role: Handle operations that do not fit within the standard API model.
Use Cases:
- File generation (PDF, CSV, etc.).
- Executing specific server-side actions.
Examples:
- PDFControllergenerates a document and returns it as a download.
Data Flow and Interactions 
- API Platform receives a request and applies entity access rules.
- A Provider modifies the retrieved data if necessary.
- A Processor applies business logic before saving data.
- Services handle complex business logic and external API interactions.
- API Platform returns a properly formatted JSON response.
API Platform and Security 
- JWT Authentication secures API access.
- Annotations manage access control directly in entities.
- Voters and Policies allow for advanced permission handling.