jefhar / laravel-domain-oriented
The Laravel Framework.
Installs: 7
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 21 260
Type:project
pkg:composer/jefhar/laravel-domain-oriented
Requires
- php: ^7.2.5
- fideloper/proxy: ^4.2
- fruitcake/laravel-cors: ^1.0
- guzzlehttp/guzzle: ^6.3
- laravel/framework: ^7.0
- laravel/tinker: ^2.0
Requires (Dev)
- facade/ignition: ^2.0
- fzaninotto/faker: ^1.9.1
- mockery/mockery: ^1.3.1
- nunomaduro/collision: ^4.1
- phpunit/phpunit: ^8.5
- dev-master
- v7.6.0
- v7.3.0
- v7.0.0
- 6.x-dev
- v6.18.8
- v6.18.3
- v6.18.0
- v6.12.0
- v6.8.0
- v6.5.2
- v6.4.0
- v6.2.0
- v6.0.2
- v6.0.1
- v6.0.0
- 5.8.x-dev
- v5.8.35
- v5.8.17
- v5.8.16
- v5.8.3
- v5.8.0
- 5.7.x-dev
- v5.7.28
- v5.7.19
- v5.7.15
- v5.7.13
- v5.7.0
- 5.6.x-dev
- v5.6.33
- v5.6.21
- v5.6.12
- v5.6.7
- v5.6.0
- 5.5.x-dev
- v5.5.28
- v5.5.22
- v5.5.0
- 5.4.x-dev
- v5.4.30
- v5.4.23
- v5.4.21
- v5.4.19
- v5.4.16
- v5.4.15
- v5.4.9
- v5.4.3
- v5.4.0
- 5.3.x-dev
- v5.3.30
- v5.3.16
- v5.3.10
- v5.3.0
- 5.2.x-dev
- v5.2.31
- v5.2.29
- v5.2.27
- v5.2.24
- v5.2.23
- v5.2.15
- v5.2.0
- 5.1.x-dev
- v5.1.33
- v5.1.11
- v5.1.4
- v5.1.3
- v5.1.1
- v5.1.0
- 5.0.x-dev
- v5.0.22
- v5.0.16
- v5.0.1
- v5.0.0
- v4.2.11
- v4.2.0
- v4.1.27
- v4.1.18
- v4.1.0
- v4.0.9
- v4.0.8
- v4.0.7
- v4.0.6
- v4.0.5
- v4.0.4
- v4.0.0
- v4.0.0-BETA4
- v4.0.0-BETA3
- dev-dependabot/composer/composer/composer-2.0.13
- dev-dependabot/composer/laravel/framework-7.30.4
- dev-develop
This package is auto-updated.
Last update: 2021-07-30 00:33:50 UTC
README
About Laravel
Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel takes the pain out of development by easing common tasks used in many web projects, such as:
- Simple, fast routing engine.
- Powerful dependency injection container.
- Multiple back-ends for session and cache storage.
- Expressive, intuitive database ORM.
- Database agnostic schema migrations.
- Robust background job processing.
- Real-time event broadcasting.
Laravel is accessible, powerful, and provides tools required for large, robust applications.
About Domain Oriented Laravel
First things first, I didn't come up with this re-design of the Laravel Framework. This builds upon the very fine blog posts by Brent. The steps from the first chapter of Brent's blog have already been performed.
Keep your application layer in app/App directories. This is where you will find the Console, Exceptions,
Http, and Providers directories. They work the same as the default Laravel application, they're just moved
down one directory, but still in the \App namespace.
Place your Domain logic organized by domain concern within the app/Domain directory in the \Domain namespace.
Support logic should be in the app/Support directory within the \Support namespace.
Caveats
Any php artisan make commands will place the newly created file where stock Laravel expects it to, not where
Domain Oriented Laravel expects it to be. If you need artisan to create the file, you will need to manually
move it to the correct directory. The default location is acceptable for database and test files.
Additional Changes
Docker
This comes with an opinionated docker stack for unit testing and deployment. Prepackaged with redis, mysql:8.0,
nginx, php:7.4 and mailhog, this stack is easily customizable to suit your needs. Simply add or change a stanza
within the docker-compose file. The Makefile contains commands to alias common
docker-compose exec commands.
User Permissions
I have added the spatie/data-transfer-object and spatie/laravel-permission packages to the composer
environment. After migrating and seeding, you will have three sample users ; a superAdmin, an employee, and
a subscriber, all with password password and email address of <username>@example.com.
The users all have sample roles and permissions which are defined as class constants in the UserRoles and UserPermissions classes.
Modify/remove the migration and
seeder files as needed. You can also add variables to your .env file
if you want to change the passwords, emails, or usernames.
** Note that the laravel/ui composer package has not been included.
Composer
I added nunomaduro/larastan, sensiolabs/security-checker, and squizlabs/php_codesniffer to the
development environment. Unless you rely soley on your IDE to tell you that you have possibly
The command composer phpcs will check your app/ and tests/ directories to make
sure all files are in accordance with PSR-12.
composer phpcbf will correct any files that it can in those directories to make sure they follow PSR-12.
Running composer pretest will first check your composer.lock file to search for any
advisories in the Security Advisories Database. If no
security advisories for your packages exist, it will make sure that larastan
approves of your code. If all is still good, your code will be examined to make sure it is in compliance with
PSR-12 standards.
composer test will run your unit and feature tests.
Gitlab CI
Domain Oriented Laravel distribution also comes with a CI pipeline for GitLab. By default, it will install the composer and npm dependencies and create a cache, based upon your gitlab repository and branch. It will then, in parallel, run your unit and feature tests, and dusk tests.
If you have installed gitlab-runner locally, either through brew
or a GitLab source, make ci will run your latest git commit through the unit and feature tests.
When you push a tagged commit to GitLab, the deployment stage will run. Before you do that, create an Envoy.php file. Also create a deployment user on your server with passwordless login:
ssh-keygen -o -a 100 -t ed25519 cat ~/.ssh/id_ed25519.pub >> ~/.ssh/authorized_keys cat ~/.ssh/id_ed25519
-
Copy your deployment user's private key to your clipboard. In your GitLab project, go to Settings > CI/CD and expand Secret variables. Paste the ssh_key as an Input variable value, and set the key to
SSH_PRIVATE_KEYand save the variables.This allows the CD system to open an
sshconnection to your server. -
Copy your deployment user's public key to your clipboard. In your Gitlab project, go to Settings > Repository and expand Deploy Keys. Paste the public key in the Key field, and give it a name. Remember to Add Key.
This allows GitLab to recognize your user and provides pull authorization from GitLab.
-
You may need to give your deployment user
chmodandchgrppermissions. This potentially opens your server to an attack vector through theEnvoy.blade.phpfile.
You can also add a $LOG_SLACK_WEBHOOK_URL variable if you want slack notifications upon deployment.
Installation
From your command line, composer create-project jefhar/laravel-domain-oriented will download and install
the framework. From there, make will build a base docker container for your development environment. After
the container has been created, make docker will create all the images needed for a complete development
environment. If you do not need MailHog running just yet, make deploy will boot all containers except
MailHog. To install composer dependencies, make composerinstall, and to update composer dependencies, make composerupdate. Installing npm dependencies is through make yarninstall. Use make yarnupgrade to upgrade
the npm dependencies.
Of course, creating your CSS and JavaScript resources are also make commands: make npmdev, make npmprod
and make npmwatch will create your resources. Similar make commands exist for phpcs, phpcbf and a
pretest.
From within the php-fpm container, make refresh will drop your database, migrate all tables, and seed
sample users.
Update your .env file and browse to http://localhost:8080.
composer create-project jefhar/laravel-domain-oriented blog cd blog make make deploy make composerinstall make yarninstall make npmdev make pretest make test docker-compose exec php-fpm sh -c 'cd /application && make refresh'
Learning Laravel
Laravel has the most extensive and thorough documentation and video tutorial library of all modern web application frameworks, making it a breeze to get started with the framework.
If you don't feel like reading, Laracasts can help. Laracasts contains over 1500 video tutorials on a range of topics including Laravel, modern PHP, unit testing, and JavaScript. Boost your skills by digging into our comprehensive video library.
Laravel Sponsors
We would like to extend our thanks to the following sponsors for funding Laravel development. If you are interested in becoming a sponsor, please visit the Laravel Patreon page.
- Vehikl
- Tighten Co.
- Kirschbaum Development Group
- 64 Robots
- Cubet Techno Labs
- Cyber-Duck
- British Software Development
- Webdock, Fast VPS Hosting
- DevSquad
- UserInsights
- Fragrantica
- SOFTonSOFA
- User10
- Soumettre.fr
- CodeBrisk
- 1Forge
- TECPRESSO
- Runtime Converter
- WebL'Agence
- Invoice Ninja
- iMi digital
- Earthlink
- Steadfast Collective
- We Are The Robots Inc.
- Understand.io
- Abdel Elrafa
- Hyper Host
- Appoly
- OP.GG
- 云软科技
Contributing
Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the Laravel documentation.
Code of Conduct
In order to ensure that the Laravel community is welcoming to all, please review and abide by the Code of Conduct.
Security Vulnerabilities
If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via taylor@laravel.com. All security vulnerabilities will be promptly addressed.
License
The Laravel framework is open-sourced software licensed under the MIT license.