anturi/larastarted

This package gives new route methods and it use a controller crud ready to use by herency

v1.1.1 2025-04-25 00:46 UTC

This package is auto-updated.

Last update: 2025-07-17 20:33:16 UTC


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 in app/Models
  • PostController.php in app/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.