glugox/magic

Tools for creating magic!

Fund package maintenance!
glugox

v1.0.0 2025-08-26 09:18 UTC

This package is auto-updated.

Last update: 2025-09-10 13:44:37 UTC


README

PHP Version License Coverage

Lightweight PHP/Laravel toolkit designed to auto-generate all essential application files from entity configurations stored in JSON files. It streamlines tasks like database seeding and realistic data generation using Faker, making it perfect for testing, prototyping, and automation.

With Magic, you can build full-featured Laravel applications directly from configuration files, eliminating repetitive boilerplate and speeding up development.

🔧 How it works magic-demo.svg

Quick Start

  1. Create a new Laravel project (if you don't have one already):
laravel new my-magic-app
  • Choose Vue starter when prompted.
  • Choose Laravel's built-in authentication when prompted.
  • Choose Pest for testing when prompted.
  • Allow Laravel to install the necessary packages when prompted.
  1. Navigate to your project directory:
cd my-magic-app
  1. Install the Magic package via Composer:
composer require glugox/magic --dev
  1. Publish the configuration file:
php artisan vendor:publish --provider="Glugox\Magic\MagicServiceProvider"
  1. For quick start Magic has some demo samples which are just json configuration files located in the stubs/samples directory. You can use one of these samples to quickly set up your application. To list all available samples, you can run:
php artisan magic:list-samples
  1. Run the magic build command with your chosen sample or your own configuration file:
php artisan magic:build --starter=inventory
  1. If you have your own json configuration file, you can run:
php artisan magic:build --config=path/to/your/config.json

To see how to create your own configuration file, check the sample configurations directory.

  1. Start your application:
npm run dev && php artisan serve

Magic Features

  • Entity Management: Define entities with fields, relations, and casts.
  • CRUD Operations: Automatically generate CRUD operations for each entity.
  • Database Migrations: Create migrations based on your entity definitions.
  • Seed Data: Optionally seed your database with sample data.
  • Configuration: Use a JSON configuration file to define your app's structure and behavior.
  • Customizable: Easily extend and customize the generated code to fit your needs.
  • Laravel Integration: Seamlessly integrates with Laravel's ecosystem.
  • Development Mode: Enable development mode to seed your database with sample data.
  • Searchable and Sortable Fields: Define fields that can be searched and sorted in your application.
  • Hidden Fields: Specify fields that should be hidden in the generated forms and views.
  • Casts: Define casts for fields to ensure data types are handled correctly.
  • Relations: Define relationships between entities, such as hasMany and belongsTo.

Starters

  • Starter Kits: Use the provided starter kits to quickly set up your application with predefined entities and configurations.

  • These are just predefined configurations that you can use to start your application quickly.

Available starter kits:

  • Task Management
  • E-commerce
  • Education
  • Resume Builder

How to use a starter kit:

  1. Choose a starter kit from the starter kits directory. Use the file name as the starter kit name.
  2. Run the magic command with the --starter option:
php artisan magic:build --starter=task-management

Ready to join?

Contact me at email for any questions or suggestions.

License

The MIT License (MIT). Please see License File for more information.