Menu

PHP CRUD application structure

FX89

PHP CRUD application architecture

The following picture explains how the generated content is layed out.

There will be one CRUD form for each registry entity. There will be one blade template for each CRUD form. There will be one AngularJS controller mentioned in the Blade template of each entity. There will be one Laravel-managed controller to handle the requests of each AngularJS controller. There will be one re-usable application data service to provide all of the required CRUD functionality. There will be one repository for each entity. The application data service calls repository methods while manipulating data.

Blade templates
- Extend a master layout which also handles all of the common imports
- Define the lists of items, the editing forms and the deletion conformation dialogs

AngularJS front-end controllers
- Handle the states of the CRUD pages (open and close dialogs, update content, etc)
- Send AJAX requests to the Laravel-managed back end
- Do not perform any exception translations, since this is just a proof of concept for syntax minimization

Laravel-managed back-end controllers
- Map the content of incoming requests to fields of new or existing entities
- Call methods of the application data service to complete the handling of the requests

Application data service
- Acts as a facade for the data layer. Calls repository methods relevant to each operation
- Ocasionally transforms entity references into entity IDs that the repositories require as parameters
- Performs translation of exceptions into the specially-generated application exception, for easier handling inside the controller

Repositories
- Provide CRUD operations such as creating new entities, modifying and deleting old entities, finding entities by their primary keys, external keys or any other relevant fields


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.