WRonX / Lumen-CRUD-generator by WRonX

Simple CRUD generation for Lumen
364
0
1
Package Data
Maintainer Username: WRonX
Maintainer Contact: wronx@wronx.net (Marcin "WRonX" Wronka)
Package Create Date: 2018-07-16
Package Last Update: 2018-10-15
Language: PHP
License: WTFPL
Last Refreshed: 2024-04-26 03:15:12
Package Statistics
Total Downloads: 364
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 0
Total Watchers: 1
Total Forks: 1
Total Open Issues: 0

Lumen CRUD Generator

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