ikechukwukalu / magicmake
A scaffolding package for an opinionated Laravel coding style.
Installs: 3 080
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 4
Requires
- php: >=7.3
- calebporzio/sushi: ^2.4
- hisorange/browser-detect: ^4.5|^5.0
- ikechukwukalu/clamavfileupload: ^2.0|^3.0
- ikechukwukalu/makeservice: ^1.0|^2.0
- ikechukwukalu/requirepin: ^1.0|^2.0
- illuminate/console: ^8.0|^9.0|^10.0|^11.0
- illuminate/support: ^8.0|^9.0|^10.0|^11.0
- knuckleswtf/scribe: ^4.29
- kreait/laravel-firebase: ^5.6
- laragear/two-factor: ^1.2|^2.0
- laravel/socialite: ^5.5
- laravel/ui: ^4.4
- mobiledetect/mobiledetectlib: ^2.8.32|^4.8
- predis/predis: ^2.1
- pusher/pusher-php-server: ^7.2
- react/http: 1.9.0
- sentry/sentry-laravel: ^4.1
- spatie/laravel-activitylog: ^4.7
- spatie/laravel-permission: ^6.3
- stevebauman/location: ^6.6|^7.0
- symfony/console: ^5.4|^6.0|^7.0
- symfony/finder: ^6.0|^7.0
Requires (Dev)
- mockery/mockery: ^1.0|^2.0
- orchestra/testbench: ^6.0|^7.0|^8.0|^9.0
- php-parallel-lint/php-parallel-lint: dev-develop
- phpunit/phpunit: ^9.0|^10.0|^11.0
This package is auto-updated.
Last update: 2024-12-26 06:44:13 UTC
README
A Laravel scaffolding package for an opinionated Laravel coding style.
REQUIREMENTS
- PHP 8.2+
- Laravel 11+
STEPS TO INSTALL
composer require ikechukwukalu/magicmake
SET UP LARAVEL
php artisan install:api
INIT CLASSES
To initialize prepared classes for a new laravel app. This would only run when env('APP_ENV') === local
and env(MAGIC_INIT_LOCK) === false
.
php artisan magic:init
MODEL BASED CLASSES
To generate all model based prepared classes.
php artisan magic:model UserKyc
To generate individual model based prepared classes.
php artisan magic:contract UserKyc --variable=userKyc --underscore=user_kyc php artisan magic:repository UserKyc --variable=userKyc --underscore=user_kyc php artisan magic:service UserKyc --variable=userKyc --underscore=user_kyc php artisan magic:controller UserKyc --variable=userKyc --underscore=user_kyc php artisan magic:createRequest UserKyc --variable=userKyc --underscore=user_kyc php artisan magic:updateRequest UserKyc --variable=userKyc --underscore=user_kyc php artisan magic:deleteRequest UserKyc --variable=userKyc --underscore=user_kyc php artisan magic:readRequest UserKyc --variable=userKyc --underscore=user_kyc php artisan magic:api UserKyc --variable=userKyc --underscore=user_kyc php artisan magic:test UserKyc --variable=userKyc --underscore=user_kyc php artisan magic:factory UserKyc --variable=userKyc --underscore=user_kyc
Note
Add this to config/api.php
.
'paginate' => [ ... 'user_kyc' => [ 'pageSize' => 10, ], ],
Add this to app/Providers/RepositoryServiceProvider.php
.
use App\Contracts\UserKycRepositoryInterface; use App\Repositories\UserKycRepository; public function register(): void { ... $this->app->bind(UserKycRepositoryInterface::class, UserKycRepository::class); }
FINISHING SETUP
If you did run php artisan magic:init
.
Add to the composer.json
file.
"autoload": { "psr-4": { "App\\": "app/", "Database\\Factories\\": "database/factories/", "Database\\Seeders\\": "database/seeders/" }, "files": [ "app/Http/Helpers.php" ] },
After that run:
composer dump-autoload
Add to bootstrap/providers.php
.
/* * Package Service Providers... */ App\Providers\EventServiceProvider::class, App\Providers\MacroServiceProvider::class, App\Providers\RepositoryServiceProvider::class,
Add to bootstrap/app.php
->withMiddleware(function (Middleware $middleware) { // $middleware->alias([ 'check.email.verification' => \App\Http\Middleware\CheckEmailVerification::class, ]); })
Add to vite.config.js
import { defineConfig } from 'vite'; import laravel from 'laravel-vite-plugin'; export default defineConfig({ plugins: [ laravel({ input: [ 'resources/sass/app.scss', 'resources/js/app.js', 'resources/css/app.css', ], refresh: true, }), ], });
Project setup
php artisan ui bootstrap npm install composer install php artisan migrate --seed
Run development server
npm run build
php artisan serve
php artisan test
NOTE
App notification helpers
$userNotificationData = new UserNotificationData($user->id, $title, $text); $user->notify(new DatabaseNotification($userNotificationData->toObject())); $emailData = new EmailData(subject: $title, lines: [$text], from: env('MAIL_FROM_ADDRESS'), remark: null, action: false, action_text: null, action_url: null, attachements: null); $user->notify(new EmailNotification($emailData->toObject())); $smsData = new SmsData($user->name, $text); $user->notify(new SmsNotification($smsData->toObject()));
LICENSE
The MM package is a software licensed under the Apache 2.0 license.