democrito88/demovel

Library that create a structure of a simple PHP project on MVC achitecture.

dev-main 2024-08-28 02:29 UTC

This package is auto-updated.

Last update: 2025-06-28 04:22:55 UTC


README

Version License PHP Symfony Composer Dependencies

Library that create a structure of a simple PHP project on MVC achitecture. It uses Symfony libraries as dependencies such as Doctrine.

Usage

Create a new project

To create a new project, install this package and run the command:

composer install
./bin/console create:new <my-new-project>

It will create a project with the following structure:

root-folder
  ├──public
  |  └──index.php
  ├──src
  |  ├──Provider
  |  |  └──EntityServiceProvider.php
  |  ├──Controller
  |  |  ├──InterfaceController.php
  |  |  ├──Controller.php
  |  |  ├──UserController.php
  |  |  └──TokenController.php
  |  └──Entity
  |     ├──Entity.php
  |     ├──User.php
  |     └──Token.php
  ├──routes
  |  ├──router.php
  |  └──routes.php
  ├──.env
  └──.htaccess

Create migration basic structure

./bin/console attach:migration

This command will create the basic structure for create and run migration classes as it follows:

root-folder
  └──database
     └──migrations
        ├──CreateTable.php
        ├──CreateUsersTable.php
        └──runMigrations.php

All migration classes must extend CreateTable class and be mentioned in runMigrations.php script.

Create seeding basic structure

./bin/console attach:seeding

This command will create the basic structure for create and run seeding classes as it follows:

root-folder
  └──database
     └──seed
        ├──Seeder.php
        ├──UsersSeeder.php
        └──runSeeders.php

All seedeing classes must extend Seeder class and be mentioned in runSeeders.php script.

Create a mail class

./bin/console attach:mail

It will create the Sender.php file inside a Email folder as it follows:

root-folder
  └──src
     └──Email
        └──Seeder.php

This package uses PHPMailer to send an email.

Create new Entity

.bin/console new:entity <name>

This command will create a new Entity class in the src/Entity directory. You just need to pass the name parameter.

This projects uses Dorctrine ORM annotations in its Entities.

Create new Controller

.bin/console new:controller <name>

This command will create a new Controller class in the src/Controller directory. You just need to pass the name parameter.

Author

Demócrito d'Anunciação