krayin/krayin-package-generator
A Laravel package generator for Krayin CRM that scaffolds new packages with boilerplate structure, service providers, configuration, and conventions, helping developers build and extend CRM features faster.
This is a dev-time scaffolding tool, not a runtime dependency. It generates the boilerplate for a Krayin module so you can skip the repetitive wiring and get straight to domain code.
composer require --dev krayin/krayin-package-generator:^2.0
The repo still has no public documentation and only a small star count, so treat the source as the spec. Read the service provider and the stubs/ directory before you run anything — that tells you exactly what you'll get.php artisan list | grep -i package
php artisan <generator-command>
The prompt walks you through the arguments — no need to guess the signature or memorize flags. Use the flag form once you're scripting module creation in CI or a team bootstrap script.composer.json (PSR-4 namespace and path), its ServiceProvider (what it registers — routes, migrations, views, translations), the routes file, and the migration stub. Those four files define how the package plugs into Krayin.Scaffold → register → migrate → iterate. Treat generation as step zero of a repeatable workflow:
php artisan <generator-command> # prompted, or pass args for scripts
composer dump-autoload
php artisan migrate
php artisan route:list | grep package-name
Follow Krayin's module convention, not Laravel's package convention. Krayin keeps modules under packages/{Vendor}/{Name} with a src/ tree, registered via a path repository in the root composer.json and a provider in the app config. Generated code should slot into that layout — resist "fixing" it into a standard vendor/package structure, because Krayin's admin UI, ACL, and menu system assume the module layout.
One package per bounded context. Use the generator per feature area (e.g. Acme/Feedback, Acme/AuditLog) rather than one giant Acme/Custom. This keeps migrations and route files small and makes it trivial to disable a module by removing its provider registration. The interactive prompt makes it cheap to spin up several small modules in one sitting.
Layered structure inside the generated package. The generator gives you the skeleton; keep domain logic in predictable folders:
src/
Models/
Repositories/ # Krayin/Webkul convention — wrap Eloquent here
Contracts/
Http/Controllers/
Http/Requests/
Database/Migrations/
Resources/views/
Routes/
Providers/
Following the Repository + Contract pattern matters if you ever want your module to feel native to Krayin's codebase and be reviewable by Webkul-style maintainers.
Wire up what the generator leaves out. Typically you will still need to:
config/app.php on older Laravel, bootstrap/providers.php on Laravel 11+).composer.json repositories/autoload if the generator doesn't.Resources/lang/ (Krayin ships many locales; missing keys fall back awkwardly).Use it for internal modules, not distributable packages. The generated scaffold assumes it lives inside a Krayin install. If your goal is a package for Packagist, you'll end up reworking the composer.json, namespaces, and test setup — Laravel's own orchestra/testbench-style scaffolding is a better base.
Customize the stubs once, for the whole team. If the generator supports publishing or overriding stub files, do it early: bake in your company's license header, declare(strict_types=1), repository/contract skeleton, and a default PHPUnit/Pest setup. Every module generated afterwards is then consistent. Re-verify overrides after the 1.x → 2.x stub changes described below.
CI hygiene. Because it's --dev, keep it out of production images. In CI, run composer install --no-dev for deploy builds and verify the generated module's autoload entries are committed, otherwise composer dump-autoload -o on the server won't see the package.
require-dev and exclude it from release builds.^2.0 on Krayin 2.x, ^1.0 on Krayin 1.x. v2.0.0's headline change is Krayin 2.0 compatibility — meaning the stubs were retargeted. Loosening the constraint (or using *) lets Composer pull a generator whose stub conventions don't match your host.Class not found errors that look like provider registration problems. Always composer dump-autoload immediately, and again after adding files.Acme/Feedback vs acme/feedback produces packages that work on macOS and 404 on the server. Pick PascalCase for namespaces, kebab-case for the composer name, and verify the generated composer.json matches.php artisan route:clear && php artisan config:clear && php artisan optimize. Make this part of your deploy step.loadMigrationsFrom only for the package's own path; if you add migrations in subfolders, they're skipped. Debug with php artisan migrate:status.web middleware. Krayin's admin area expects its own auth/ACL middleware and route prefix. Copy the middleware stack from an existing Krayin 2.x module rather than inventing one, and add the ACL permission record or admins can't reach your screens.Menu class) and mirror it.packages/Webkul/. Diffing a generated module against a core module is the single most effective way to spot missing wiring — and it's now also the fastest way to see what changed in the v2 stubs.How can I help you explore Laravel packages today?