Download the PHP package luthfi/simple-crud-generator without Composer

On this page you can find all versions of the php package luthfi/simple-crud-generator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package simple-crud-generator

Laravel Simple CRUD Generator

Build Status Total Downloads

Need faster TDD in Laravel project? This is a simple CRUD generator complete with automated testing suite.

Documentation

For installation instructions and usage, please take a look at the official documentation.

About this package

This package contains artisan make:crud commands to create a simple CRUD feature with test classes on our Laravel 5.5 (and later) application. This package is fairly simple, to boost test-driven development method on our laravel application.

With this package installed on local environment, we can use (e.g.) php artisan make:crud Vehicle command to generate some files :

It will update some file :

It will also create this file if it not exists :


Main purpose

The main purpose of this package is for faster Test-driven Development, it generates model CRUD scaffolds complete with Testing Classes which will use Laravel Browserkit Testing package and PHPUnit.


How to install

For Laravel 10x

For Laravel 9.x

For Laravel 8.x

For Laravel 5.6 to 7.x

For Laravel 5.5

To use this package on laravel 5.5, we need to add the package (with browserkit) within require-dev in composer.json file, like so :

The package will auto-discovered.


How to use

Just type in terminal $ php artisan make:crud ModelName command, it will create simple Laravel CRUD files of given model name completed with tests.

For example we want to create CRUD for 'App\Models\Vehicle' model.

Make sure we have set database credential on .env file, then :

Then visit our application url: http://localhost:8000/vehicles.


Usage on Fresh Install Laravel 8.x

In this example, we are using the laravel installer package to install new laravel project.

Available Commands


Model Attribute/column

The Model and table will only have 2 pre-definded attributes or columns : title and description on each generated model and database table. You can continue working on other column on the table.


Bootstrap 4 Views

The generated view files use Bootstrap 4 by default (for Laravel 5.6 and later).


Bootstrap 3 Views

We can also generates views that use Bootstrap 3 with --bs3 command option, eg for Laravel version 5.5.


For API

If we want to generate API Controller with feature tests, we use following command :

By default, we use Laravel Token Based Authentication, so we need to update our user model.

  1. Add api_token column on our users_table_migration.
  2. Add api_token as fillable property on User model.
  3. Add api_token field on our UserFactory.


API Usage

The generated API is a REST API, using GET and POST verbs, with a URI of /api/modelname.

Example code for calling the generated API, using Guzzle:

// Read data a specific Vehicle record...
$uri = 'http://your-domain.com/api/vehicles/'.$vehicleID;
$headers = ['Authorization' => 'Bearer '.$apiToken];

$client = new \GuzzleHttp\Client();
$res = $client->request('GET', $uri, ['headers' => $headers]);


// Create a new Vehicle record...
$uri = 'http://your-domain.com/api/vehicles';
$headers = ['Authorization' => 'Bearer '.$apiToken];
$payload = json_encode([
    'title' => 'Vehicle Name 1',
    'description' => 'Vehicle Description 1',
]);

$client = new \GuzzleHttp\Client();
$res = $client->request('POST', $uri, ['body' => $payload, 'headers' => $headers]);

The generated functional tests will give you examples of how to adapt this code for other call types.


Config file

You can configure your own by publishing the config file:

That will generate config/simple-crud.php file.

By default, this package have some configuration:


Publishing Stub Files

Stub files is the templates which we use to generate the code for each model classes and files. We can customize the stub files as we needed by publishing them to our project directory.

That will generate stub files on stubs/simple-crud directory. Now we can change some stub files based on our project needs.


Attention


Screenshots

Visit your application in new resource route : http://127.0.0.1:8000/vehicles


Generated testing suite

Next, let us try the generated testing suite. To use the generated testing classes, we can set the database environment using in-memory database SQLite. Open phpunit.xml. Add two lines below on the env :

Then run PHPUnit

All tests should be passed.


Issue/Proposal

If you find any issue, or want to propose some idea to help this package better, please create an issue in this github repo.


License

This package is open-sourced software licensed under the MIT license.


All versions of simple-crud-generator with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0
laravel/browser-kit-testing Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package luthfi/simple-crud-generator contains the following files

Loading the files please wait ....