forked from jvilarroig/MyNotes
2.5 KiB
2.5 KiB
Laminas
Like:
- Free Software
- 100% OOP
- Well known and standarized development patterns
- Configuration Items data:
- Nothing to be done trhoug an interface.
- Nothing store in DB.
- Everything is done in a file in PHP no "magic" XML filesD
- MVC+Middleware+API include
- 700+ packages available
- Built for Unit testing in mind
Don't like:
- Too much boilerplate (?)
Requirements Debian:
- php-dev
- composer
Notes:
- Use spl_autoload_register to automate class load and make cleaner source code. (Devmode)
Routing
Pages -> Equivalent to action (Create, Edit, View, Delete, run a service, etc...)
Controller -> Group of actions -> Group of pages
Routes -> Map URLs to actions
Modules
A module is a group of functionality in the form of a Model a Controller and one or more Views. Can be seen as an entity.
The Model persists the data and enforces the business rules.
The Controller routes http calls -> Reacts to user actions
- Controller pases the data to the view with a ViewModel object
The View produces HTML pages
- Receives the data from the Controller by a ViewModel object
Are modules general enough to be used for a full Spinco product? or a main entity in the datamodel?
- Modules must be registered at /composer.json for class autoloading
- Run
composer dump-autoload
after modifying it
- Run
- Modules must be registered at /config/modules.config.php to make app aware of it.
Composed by:
- config/
- modules.config.php
- Controllers available for the module
- Routes
- View manager
- Service Manager
- modules.config.php
- src/
- Module.php
- Must implement getConfig from ConfigProviderInterface to load the module configuration.
- module.config.php
- Controller/
- Form/
- Model/
- Entity model (ex. Album.php)
- Model contains the business logic
- It's used by the controller to retieave an persist data
- MUST implement exchangeArray method
- This is the method that persists the data in collaboration with Lamina's
TableGateway
class
- This is the method that persists the data in collaboration with Lamina's
- Entity table (ex. AlbumTable.php)
- The class that interacts with the database via the
TableGatewayInterface
given in the constructor Only one instance is to be created by theServiceManager
- The class that interacts with the database via the
- Entity table Factory (ex. AlbumTableFactory)
- Used by the Service Manager to create the instance.
- Entity model (ex. Album.php)
- Module.php
- view/
- album(?)/
- album(?)
- album(?)/