fukibay/laravel-starter-pack
Interactive Laravel starter pack for clean architecture with Repository/Service layers. One install command scaffolds base infrastructure, error handling, helpers, and DB config. Includes smart make commands, SoftDeletes auto-detection, QueryParameters DTO, MySQL/PostgreSQL support.
Installation
Run composer require fukibay/laravel-starter-pack in your Laravel project.
Publish the package assets with php artisan vendor:publish --provider="Fukibay\StarterPack\StarterPackServiceProvider" to generate config files.
First Command Kickstart your project’s infrastructure with:
php artisan fukibay:install
Follow the interactive prompts (e.g., database driver, table prefix).
First Use Case
Generate a Repository + Service pair for a model (e.g., User):
php artisan fukibay:make:repository User
php artisan fukibay:make:service User
This creates:
app/Repositories/UserRepository.php (with soft-deletes logic if HasSoftDeletes is used in the model).app/Services/UserService.php (with repository injection and soft-delete-aware methods).Layered Architecture Use the package to enforce Repository Pattern (data access) + Service Layer (business logic) separation. Example:
// Service layer (app/Services/UserService.php)
public function deleteUser($id) {
return $this->userRepository->delete($id); // Soft-delete if enabled
}
Interactive Scaffolding Chain commands for rapid setup:
php artisan fukibay:make:model Post -m --migration=posts
php artisan fukibay:make:repository Post
php artisan fukibay:make:service Post
Flags:
-m: Create migration.--migration=: Specify migration name.Soft Deletes Integration
The package auto-detects HasSoftDeletes in models and generates:
forceDelete(), restore().softDelete(), permanentlyDelete().Customize Templates
Override default stubs in resources/stubs/ (publish with php artisan vendor:publish --tag=starter-pack-stubs).
Example: Modify repository.stub to add custom query scopes.
Service Binding
Bind services in AppServiceProvider for dependency injection:
$this->app->bind(UserService::class, function ($app) {
return new UserService(new UserRepository());
});
API Controllers
Pair with laravel-api or similar to auto-generate controllers:
php artisan fukibay:make:repository Post
php artisan api:controller PostController --repository=PostRepository
Soft Deletes Mismatch
HasSoftDeletes but the repository lacks forceDelete(), manually add:
public function forceDelete($id) {
return $this->model->where('id', $id)->forceDelete();
}
usesSoftDeletes property is set in the generated repository.Migration Conflicts
fukibay:make:model -m after migrations exist may cause conflicts. Use --force cautiously:
php artisan fukibay:make:model Post -m --force
Config Overrides
starter-pack.php config. Override defaults (e.g., repository_namespace) before running commands:
'repository_namespace' => 'App\\Repositories\\Custom\\',
Command Errors
Enable debug mode in config/starter-pack.php:
'debug' => env('APP_DEBUG', false),
Check logs in storage/logs/laravel.log for interactive prompt failures.
Stub Path Issues
If templates aren’t found, verify the stubs_path in the config points to the published stubs:
'stubs_path' => __DIR__.'/../../../resources/stubs/',
Custom Commands Extend the package by creating a custom command that uses its helpers:
use Fukibay\StarterPack\Commands\MakeRepositoryCommand;
class CustomMakeCommand extends MakeRepositoryCommand {
protected $signature = 'custom:make {name}';
// Override logic here
}
Event Listeners
Hook into the repository.created event to post-process repositories:
// In EventServiceProvider
protected $listen = [
'Fukibay\StarterPack\Events\RepositoryCreated' => [
'App\Listeners\AddCustomScopeToRepository',
],
];
Testing Mock repositories/services in tests:
$this->mock(UserRepository::class)->shouldReceive('find')->andReturn($user);
How can I help you explore Laravel packages today?