wronx/lumen-crud-generator

Simple CRUD generation for Lumen

Installs: 368

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 0

Type:lumen-package

v0.4 2018-10-15 10:39 UTC

This package is auto-updated.

Last update: 2024-11-16 04:22:44 UTC


README

IMPORTANT: This package is a work in progress, it it not stable by any means.
Use responsibly! Or don't use at all and wait for v1.0.

The purpose of this project

It was created to make creating simple Lumen APIs easier and faster, automating repeatable tasks.

Is it any good?

Yes

(well, it will be in stable version... I hope...)

Installation

  1. Install the package with Composer:
composer require --dev wronx/lumen-crud-generator
  1. Enable it in bootstrap/app.php:
// edit the environment condition below:
if(!in_array($app->environment(), ['staging', 'production']))
    $app->register(WRonX\LumenCrudGenerator\Providers\LumenCrudGeneratorProvider::class);
  1. Check if the make:crud command is present in the Artisan list.

Usage

php artisan make:crud myModelName [options]

The command always created CRUD controller for model, the rest depends on the provided options:

  • -r|--create-routes adds CRUD routes to routes file
  • -w|--use-middleware uses RestObjectFetch middleware in controller and routes (see middleware page to learn more)
  • -m|--create-model for now it calls make:model command from Lumen Generator, hopefully it will be changed later
  • -g|--create-migration for now it calls make:migration command, hopefully it will be changed later
  • -t|--create-tests creates CRUD tests code (needs some editing inside the file!)

It creates separate CRUD subdirectory for tests, so in order to use tests, you need to update TestCase (or whatever your main class is) with Tests namespace, which involves adding namespace Tests; line on the top and leading slash before Laravel in parent class name.

Contributing

If you want to contribute, please wait. Until stable version arrives I want to shape this package in my specific way. Later on, pull requests will be welcome.

License:

Copyright © 2016 github.com/WRonX
This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for more details