Download the PHP package drewlabs/g-cli without Composer

On this page you can find all versions of the php package drewlabs/g-cli. 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 g-cli

GCli

This project uses the code generator package to create components like controllers, services, models etc for laravel projects...

Usage

Programming API

This section present you with PHP classes API for creating controllers, Services, Model, ViewModel and Data Transfert Object

The Controller Builder

This package provide you with a controller class builder that can be used to build a resource controller, an invokable controller or a pre-made CRUD controller.

Service class builder

A service is like a delegate that handle controller action and has access to the database model.

You can create a service that provides empty implementation or is pre-filled with CRUD operations.

View Model class builder

A view model is a class that wrap arround user provided values, validation rules and if possible a reference to the authenticated user.

Model class builder

A database model is like en entity manager class that interact with database on your behalf. They packahe provides an implementation of the Eloquent ORM model.

This implementation use the drewlabs/database package for the builder and it suppose that package is install as dependency. You are free to provide an implementation of your on builder.

Laravel Commands interfaces

The package offers some laravel framework commands for easily creating component from your terminal application. Those commands are:

drewlabs:mvc:create command

This command allow devolpper to generate an entire api stack from database tables, with a pre-defined structure. The generated output is configurable using artisan command interface input:

Disabling caching

By default the command use caching to optimize the task when generating more than once required components. using the command below, the command will ignore the cache and re-generate previously generated files:

Removing schema prefix

In some application, databases are prefixed using schema name. Generated code will mostly add the schema prefix to classes and interfaces. To prevent such output, developper can use --schema option to allow the tell the command to trim the schema part from generated classes:

Adding middleware

Sometimes developpers might want to group generated routes in a given middleware. The command interface provide an option to specify the middleware to use when grouping generated route using:

Table filters

The command interface also support an --only option wich allow developpers to specify the list of table to include when generating code:

Warning The --only option is in an experimental status, and as it can rewrite your routing file removing previously generated routes.

Setting route file name

By default the routing file name used by the command is web.php located in the /routes directory of the laravel project. To override the default:

The command above use or create a file in the project /routes directory for routing.

Model relations

drewlabs:mvc:create provides a flag for generating relation method definition while generating model class definition. Using --relations flag, developpers can generate model with corresponding relations.

FAQ How can model relation methods can be customized ?

The command support argument for model relation customization. using --manytomany, --toones, --manythroughs, --onethroughs, developpers are able to specify relation that are many to many, one to one, many through and one through relation respectively.

The syntax for various customization are:

Note [method] part of the syntax can be omitted and will be generated by the command.

Note [method] part of the syntax can be omitted and will be generated by the command.

Note [method] part of the syntax can be omitted and will be generated by the command.

Policy & Guard

From version 2.9, drewlabs:mvc:create command suport flag for adding policy guard definition to your project with default to allowing every controller action using authorize method. To generate policy classes use the --policies flag when running command.

Note A service provider class [\App\Providers\PoliciesServiceProvider::class] class is generated at the end of the command output. Please add it to let laravel know how to guard your model classes using generated policies.

Note To preview the list of available options, please use the php artisan drewlabs:mvc:create --help

Create a database model

Create a php class

Note Use php artisan drewlabs:mvc:make:class --help command view the list of option available

Create a data transfert object

Note Use php artisan drewlabs:mvc:make:dto --help command view the list of option available

Create a MVC service

Note Use php artisan drewlabs:mvc:make:service --help command view the list of option available

Create a MVC view model

Note Use php artisan drewlabs:mvc:make:viewmodel --help command view the list of option available

Create a MVC controller

Note Use php artisan drewlabs:mvc:make:controller --help command view the list of option available


All versions of g-cli with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
drewlabs/code-generator Version ^0.2.4
drewlabs/core-helpers Version ^0.2.2|^0.3
drewlabs/htr Version ^0.2.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 drewlabs/g-cli contains the following files

Loading the files please wait ....