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-15 05:33:07 UTC


README

PHP Version License Coverage

Magic is a lightweight PHP/Laravel toolkit that auto-generates application files from entity configurations stored in JSON files.

It streamlines tasks like database migrations, seeding, and realistic data generation with Faker β€” making it ideal 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 yet):

    laravel new my-magic-app

    When prompted:

    • Choose Vue starter.
    • Choose Laravel’s built-in authentication.
    • Choose Pest for testing.
    • Allow Laravel to install the required packages.
  2. Navigate into your project:

    cd my-magic-app
  3. Install Magic via Composer:

    composer require glugox/magic --dev
  4. Publish the configuration file:

    php artisan vendor:publish --provider="Glugox\Magic\MagicServiceProvider"
  5. Explore demo samples (JSON config files in stubs/samples):

    php artisan magic:list-samples
  6. Build your app using a starter:

    php artisan magic:build --starter=inventory
  7. Or use your own config file:

    php artisan magic:build --config=path/to/your/config.json

    πŸ‘‰ See the sample configurations directory for examples.

  8. Run the app:

    npm run dev
    php artisan serve

✨ Features

  • Entity Management – Define entities with fields, relations, casts.
  • CRUD Generation – Auto-generate CRUD for every entity.
  • Migrations – Create DB migrations from your definitions.
  • Seeding – Seed sample or Faker-based data.
  • Config-Driven – JSON-powered structure & behavior.
  • Extensible – Override stubs, extend generators.
  • Laravel Native – Fully integrated into Laravel workflow.
  • Development Mode – Quickly spin up test data.
  • Search & Sort – Mark fields as searchable/sortable.
  • Hidden Fields – Exclude fields from forms/views.
  • Casts – Ensure correct field data types.
  • Relations – Define hasMany, belongsTo, etc.

πŸ“¦ Starter Kits

Use predefined configurations to bootstrap your app:

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

How to use:

  1. Pick a starter from the samples directory (use file name as starter name).

  2. Run:

    php artisan magic:build --starter=task

🀝 Contributing / Contact

Got ideas or feedback?
Reach out via email.

πŸ“„ License

The MIT License (MIT). See LICENSE for details.

composer require glugox/magic:@dev --prefer-source --repository='{"type":"path","url":"/Users/ervin/Code/github.com/glugox/magic"}'