anturi / larastarted
This package gives new route methods and it use a controller crud ready to use by herency
Requires
- illuminate/console: ^12.1
- illuminate/database: ^12.1
- illuminate/http: ^12.1
- illuminate/routing: ^12.1
- illuminate/support: ^12.1
Requires (Dev)
- phpunit/phpunit: 11.5.x-dev
README
A Laravel library designed to speed up your development with automatic generation of models, controllers, migrations, routes, standardized responses, and more. Perfect for RESTful APIs with a clean and professional structure. ๐งโโ๏ธ
Requirements
Install the API base setup with the following command:
php artisan install:api
๐ Installation
Option 1: Use it locally
Clone the repo or add it as a local package, then run:
composer require anturi/larastarted:dev-main
๐ Make sure your branch is
main
or adjust the branch name accordingly.
๐ ๏ธ What does Larastarted do?
With just one command, it automatically generates:
- ๐ง Model (
app/Models
) - ๐ฎ Controller (
app/Http/Controllers
) - ๐งฑ Migration (
database/migrations
) - ๐ค API Route (
routes/api.php
) - ๐งน Base configuration
- ๐๏ธ Logs with their own table (
logs
)
โจ Available Commands
๐ง anturi:generate
php artisan anturi:generate Post posts
This command will generate:
Post.php
inapp/Models
PostController.php
inapp/Http/Controllers
- A migration for
posts
- A route entry in
routes/api.php
๐ Interactive Questions Example
When running the command, you'll be asked a few questions to customize your resource:
->expectsQuestion('Do you wish to create a migration?', true) ->expectsQuestion('Name of field (leave empty to finish)', 'title') ->expectsQuestion("Select the data type for 'title'", 'string') ->expectsQuestion("Length for 'title'? (leave empty to use default)", '255') ->expectsQuestion("Can the 'title' field be nullable?", false) ->expectsQuestion('Field name (leave empty to finish)', '') ->expectsQuestion('Do you want to add relationships?', false) ->expectsQuestion('Do you want to add a middleware to the route?', false)
๐งน Folder Structure
Larastarted/
โโโ src/
โ โโโ Commands/ โ Artisan commands
โ โโโ config/ โ Configuration files
โ โโโ Controllers/ โ Reusable base controllers
โ โโโ Generators/ โ Generation logic (Model, Controller, etc)
โ โโโ Helpers/ โ Reusable services (logs, CRUD, responses)
โ โโโ Migrations/ โ Internal package migrations
โ โโโ Models/ โ Models used by the package
โ โโโ Providers/ โ Package's Service Provider
โ โโโ Publishable/ โ Files that can be published to the host app
โ โโโ Routes.php โ Auto-injected routes
โ โโโ Traits/ โ Useful traits like FieldBuilder
โ โโโ test/ โ Unit and feature tests
๐ Configuration
The AnturiServiceProvider
does the magic:
- Registers artisan commands
- Injects routes automatically
- Loads internal migrations
- Publishes configurations
$this->loadMigrationsFrom(__DIR__.'/../Migrations'); $this->loadRoutesFrom(__DIR__.'/../Routes.php'); $this->publishes([...], 'larastarted-config');
๐ฑ Vendor Publishing
Itโs highly recommended to publish the vendor files before using:
php artisan vendor:publish --tag=anturi-larastarted
๐งช Testing
This package includes tests for:
- Generators
- Artisan commands
- Traits
php artisan test
๐ง Credits
Crafted with ๐ by Julian (a.k.a. Dimitri Rocket) ๐
Inspired by real-world needs for clean, fast API development.