saeven-laminas-mvc-skeleton
Introduction
This is a skeleton application based on the Laminas MVC skeleton that adds AlpineJS, Twig, Doctrine, Circlical/User, Assetic, TailwindCSS and more!
demo.mov
Installation
- Clone this project, composer install
- Create a MySQL database for the project
- Enter your database details into config/autoload/database.local.php
- Spawn your database tables with the Doctrine CLI
$ ./vendor/bin/doctrine-module orm:schema-tool:update --force
This ought to run 20 queries or so (at time of writing). With the tables in place with all rights granted to your user, issue this query:
INSERT INTO `skeleton`.`acl_roles` (`name`)
VALUES ('user')
Test it out immediately using PHP's built-in web server:
$ cd path/to/install
$ php -S 0.0.0.0:8080 -t public
# OR use the composer alias:
$ composer run --timeout 0 serve
This will start the cli-server on port 8080, and bind it to all network interfaces. You can then visit the site at http://localhost:8080/
- which will bring up this sample rig.
Note: The built-in CLI server is for development only.
What it does
Load it up, register, and add/remove tokens to see how my circlical user, tailwind-forms and autowire library can interact with one another.
Module (Soflomo\Purifier) could not be initialized
I clone the project and run composer install. Than I tried to create the MySQL database for the project with and got this error message. Also in the browser I got this error.
$ ./vendor/bin/doctrine-module orm:schema-tool:update --force
This module has got its last update 5 years ago. I am not sure if this should be used anymore.
One way to easily achieve an email validation requirement.
A status object is added to the User. In my prod apps, we typically add more information, such as browser fingerprints, etc. Here, it is kept very simple.
When the user registrations, the registration event is fired, and it triggers sending an email. If your mail() doesn't work, you can just lift the hash from the database. The email contains a link to http://0.0.0.0:8080/register/verify/%s, where %s is the hash.
If validation is required, and validation is incomplete, all routes are intercepted by RegistrationListener. The user will be consistently redirected to a validation screen.
Not thorough, but gives enough to easily expand upon.