| Installation | Usage | Configuration | The Sources | Custom Sources | Diagrams |
Revamp takes your normal files hierarchy and adds a _concepts folder filled with links to the important files sorted and grouped by model. Every change made to thoses files will affect the target file since they are the same file.
For example, the model
/app/Models.School.php
is the same file as_concepts/School/Model.php
. Easier to find, easier to maintain.
See the diagrams for more details.
composer require --dev bobabum/revamp
php artisan revamp
Will add new links but will not delete obsolete links.
php artisan revamp:back
php artisan revamp:refresh
php artisan vendor:publish --tag=config
Will publish the config file config/revamp.php
Config | Description | Default |
---|---|---|
folder_name |
The folder where the concepts are stored | _concepts |
shorten_names |
If true, will remove the concept's name from the file name. Making Table/Controller.php instead to Table/TableController.php |
true |
sources |
🔜The sources of files for one concept (see below). If sources is given, only those sources will be rendered. |
null for all the sources |
excluded_sources |
🔜The sources of files to exclude for one concept. If excluded_sources is set, sources will be ignored. |
null for no excluded sources |
excluded_concepts |
🔜The concepts to exclude. Ex.: ['App'] |
null for no excluded concepts |
custom_sources |
The custom sources to add to the sources. (see below) | null for no custom sources |
custom_sources |
Source | Description | Location |
---|---|---|
Global |
Some files not linked to a concept | Various |
Model |
The model file. 🔍Revamp will use found Models to use as concepts | app/Models |
Controller |
The controller file. 🔍Revamp will use found Controllers to use as concepts | app/Http/Controllers |
Migration |
The migration file. Revamp will use the migration file creating the table: *_create_*_table.php |
database/migrations |
Seeder |
The seeder file | database/seeders |
Factory |
The factory file | database/factories |
Policy |
The policy file | app/Policies |
Request |
The requests files (Store and Update) | app/Http/Requests |
View |
🚧 The view folder (not working actually) | resources/views |
Route |
The route file (if one create a concept.php in the routes folder) |
routes |
VueModel |
The vuejs file (if one create a Concept.js in the resources/js/models folder) |
resources/js |
VuePages |
🔜 The vuejs pages folder |
resources/js/pages |
VueComponents |
🔜 The vuejs components folder |
resources/js/components |
You can add custom sources to the config file. The key is the destination file or folder.
- If the key starts with
/
, the value must then be another array of custom sources and the key will be the destination folder. - The key (destination) can be a
preg_replace
replace pattern($1
,$2
...). The value (source) must then contain a matching number of*
. Ex.:'$2/$1.php' => 'views/*/*.php'
- The value (source) can be a string or an array.
- If it's an array:
- the first value will be the source file or
glob
pattern - the second value will be a callable that returns a path like
resource_path
orbase_path
- the third value will be a callable that will let revamp modify the matches for every
*
in the source file orglob
pattern. Ex.:fn(&$matches) => $matches[1] = strtoupper($matches[1])
- the first value will be the source file or
Original Laravel Hierarchy
📦my-laravel-project
┣━📂app
┃ ┣━📂Http
┃ ┃ ┣━📂Controllers
┃ ┃ ┃ ┣━📜Controller.php
┃ ┃ ┃ ┣━📜DepartmentController.php
┃ ┃ ┃ ┣━📜SchoolController.php
┃ ┃ ┃ ┗━📜TeacherController.php
┃ ┃ ┗━📂Requests
┃ ┃ ┣━📜StoreDepartmentRequest.php
┃ ┃ ┣━📜StoreSchoolRequest.php
┃ ┃ ┣━📜StoreTeacherRequest.php
┃ ┃ ┣━📜UpdateDepartmentRequest.php
┃ ┃ ┣━📜UpdateSchoolRequest.php
┃ ┃ ┗━📜UpdateTeacherRequest.php
┃ ┣━📂Models
┃ ┃ ┣━📜Department.php
┃ ┃ ┣━📜School.php
┃ ┃ ┣━📜Teacher.php
┃ ┃ ┗━📜User.php
┃ ┗━📂Policies
┃ ┣━📜DepartmentPolicy.phpz
┃ ┣━📜SchoolPolicy.php
┃ ┗━📜TeacherPolicy.php
┣━📂concepts
┃ ┣━📂Department
┃ ┃ ┣━📜Controller.php
┃ ┃ ┣━📜Factory.php
┃ ┃ ┣━📜migration.php
┃ ┃ ┣━📜Model.php
┃ ┃ ┣━📜Seeder.php
┃ ┃ ┣━📜StoreRequest.php
┃ ┃ ┗━📜UpdateRequest.php
┃ ┣━📂School
┃ ┃ ┣━📂views
┃ ┃ ┃ ┗━📜index.blade.php
┃ ┃ ┣━📜Controller.php
┃ ┃ ┣━📜Factory.php
┃ ┃ ┣━📜migration.php
┃ ┃ ┣━📜Model.php
┃ ┃ ┣━📜Policy.php
┃ ┃ ┣━📜Seeder.php
┃ ┃ ┣━📜StoreRequest.php
┃ ┃ ┗━📜UpdateRequest.php
┃ ┣━📂Teacher
┃ ┃ ┣━📜Controller.php
┃ ┃ ┣━📜Factory.php
┃ ┃ ┣━📜migration.php
┃ ┃ ┣━📜Model.php
┃ ┃ ┣━📜Policy.php
┃ ┃ ┣━📜Seeder.php
┃ ┃ ┣━📜StoreRequest.php
┃ ┃ ┗━📜UpdateRequest.php
┃ ┗━📂User
┃ ┣━📜Factory.php
┃ ┣━📜migration.php
┃ ┗━📜Model.php
┣━📂database
┃ ┣━📂factories
┃ ┃ ┣━📜DepartmentFactory.php
┃ ┃ ┣━📜SchoolFactory.php
┃ ┃ ┣━📜TeacherFactory.php
┃ ┃ ┗━📜UserFactory.php
┃ ┣━📂migrations
┃ ┃ ┣━📜create_users_table.php
┃ ┃ ┣━📜create_schools_table.php
┃ ┃ ┣━📜create_departments_table.php
┃ ┃ ┗━📜create_teachers_table.php
┃ ┗━📂seeders
┃ ┣━📜DatabaseSeeder.php
┃ ┣━📜DepartmentSeeder.php
┃ ┣━📜SchoolSeeder.php
┃ ┗━📜TeacherSeeder.php
┣━📂resources
┃ ┗━📂views
┃ ┗━📂school
┃ ┣━📜index.blade.php
┃ ┗━📜show.blade.php
┗━📂routes
┣━📜api.php
┣━📜channels.php
┣━📜console.php
┗━📜web.php
Revamped hierarchy in `_concepts` folder:
📦my-laravel-project
┣━📂_concepts
┃ ┣━📂Department
┃ ┃ ┣━📜Controller.php
┃ ┃ ┣━📜Factory.php
┃ ┃ ┣━📜migration.php
┃ ┃ ┣━📜Model.php
┃ ┃ ┣━📜Seeder.php
┃ ┃ ┣━📜StoreRequest.php
┃ ┃ ┗━📜UpdateRequest.php
┃ ┣━📂School
┃ ┃ ┣━📂views
┃ ┃ ┃ ┣━📜index.blade.php
┃ ┃ ┃ ┗━📜show.blade.php
┃ ┃ ┣━📜Controller.php
┃ ┃ ┣━📜Factory.php
┃ ┃ ┣━📜migration.php
┃ ┃ ┣━📜Model.php
┃ ┃ ┣━📜Policy.php
┃ ┃ ┣━📜Seeder.php
┃ ┃ ┣━📜StoreRequest.php
┃ ┃ ┗━📜UpdateRequest.php
┃ ┣━📂Teacher
┃ ┃ ┣━📜Controller.php
┃ ┃ ┣━📜Factory.php
┃ ┃ ┣━📜migration.php
┃ ┃ ┣━📜Model.php
┃ ┃ ┣━📜Policy.php
┃ ┃ ┣━📜Seeder.php
┃ ┃ ┣━📜StoreRequest.php
┃ ┃ ┗━📜UpdateRequest.php
┃ ┗━📂User
┃ ┣━📜Factory.php
┃ ┣━📜migration.php
┃ ┗━📜Model.php
┗━...