colbeh/laranit
Laravel package for interacting with the Laranit service from your app, providing basic integration helpers and configuration to connect, send requests, and handle responses. Suitable for projects needing a simple bridge between Laravel and Laranit APIs.
Installation
composer require colbeh/laranit
Publish the package config (if needed):
php artisan vendor:publish --provider="Colbeh\Laranit\LaranitServiceProvider"
First Use Case
Initialize Laravel with default configurations (e.g., .env, config/app.php, and basic project structure) via:
php artisan laranit:init
mkdir my-project && cd my-project).Where to Look First
config/laranit.php (if published) for customization.php artisan to list laranit: commands.Bootstrapping a New Project
laranit:init to scaffold a Laravel project with pre-configured settings (e.g., auth scaffolding, queues, caching).php artisan laranit:init --with-auth --with-queue
Customizing Initialization
.laranit.json (if supported) or environment variables:
{
"timezone": "America/New_York",
"locale": "en_US",
"database": {
"driver": "mysql",
"host": "127.0.0.1"
}
}
php artisan laranit:init --timezone="Asia/Kolkata" --locale="hi_IN"
Integration with CI/CD
# Example GitHub Actions step
- name: Initialize Laravel
run: php artisan laranit:init --env=production --force
Extending Functionality
// app/Providers/LaranitCustomizer.php
use Colbeh\Laranit\Events\InitializationFinished;
class LaranitCustomizer extends ServiceProvider {
public function boot() {
InitializationFinished::listen(function () {
// Add post-init logic (e.g., install Composer packages)
shell_exec('composer require spatie/laravel-permission');
});
}
}
Overwriting Existing Files
laranit:init will overwrite files in the target directory. Use --force cautiously or back up existing files first.ls -la before initialization to check for critical files.Environment Variable Conflicts
.env exists, the package may skip or merge settings. Use --env flag to force overwrite:
php artisan laranit:init --env=staging
Database Configuration
DB_DATABASE) may not match your local setup. Verify config/database.php after initialization.Dependency Conflicts
composer.json for conflicts:
composer why-not laravel/framework 10.*
Verbose Output Enable debug mode for detailed logs:
php artisan laranit:init --verbose
Dry Run Test initialization without changes (if supported):
php artisan laranit:init --dry-run
Event Listeners
Debug initialization events by listening to Colbeh\Laranit\Events\* in EventServiceProvider:
protected $listen = [
InitializationStarted::class => [
\App\Listeners\LogInitStart::class,
],
];
Template Customization
resources/views/auth/) by copying them to your project before running laranit:init.Post-Initialization Tasks
php artisan laranit:init && composer install && php artisan key:generate
Git Ignore
.laranit.json or laranit-* files to .gitignore if they’re auto-generated and not needed in version control.Local Development
--with-docker (if supported) to auto-generate docker-compose.yml for local setups:
php artisan laranit:init --with-docker
How can I help you explore Laravel packages today?