Download the PHP package jfheinrich-eu/laravel-make-commands without Composer

On this page you can find all versions of the php package jfheinrich-eu/laravel-make-commands. 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 laravel-make-commands

Laravel Make Commands

Owner Package Release Code Coverage Last Activity

This package is aimed to be a suite of artisan commands and tools to help make the work easier.

Installation

To publish the assets and config file, run following command:

This install the config file to [Project root]/app/config/make-commands.php and the stubs to [Project root]/stubs/make-commands.

To install only the config file, use this command:

To install only the stubs, use this command:

Make interface (make-commands:interface)

Creates a new interface in app\Contracts

Example

Make repository (make-commands:repository)

Creates a new repository.

Optionally you can give the model on which the repository should based on. In this case, the command creates a repository with

The generic class RepositoryDto:

The attributes property of RepositoryDto gets the required columns from the model as illuminate\Support\Collection.

This collection can be constructed like this:

Usage:

Example

app/Repositories/UserRepository.php

Make a service (make-commands:service)

Creates a new service class, which can optionally implement a existing interface and can based on a existing repository.

Example

Use existing interface App\Contracts\UserPostInterface

app/Services/UserPostService.php

Data transfer object (DTO) (make-commands:dto)

Based on the great work of Steve McDougall with his package laraval-data-object-tools.

I extend this package with implementation of „JsonSerializable“.

Usage

To generate a new DTO all you need to do is run the following artisan command:

This will generate the following class: app/Dto/MyDto.php. By default this class will be a final class that implements a DtoContract, which extends JsonSerializable, which enforces two methods

If you are using PHP 8.2 however, you will by default get a readonly class generated, so that you do not have to declare each property as readonly.

Example

app/Dto/MyDto.php

Work with the hydration functionality

To work with the hydration functionality you can either use Laravels DI container, or the ready made facade.

Using the container:

To work with the facade, you can do something very similar:

Object Hydration

Under the hood this package uses an EventSauce package, created by Frank de Jonge. It is possibly the best package I have found to hydrate objects nicely in PHP. You can find the documentation here if you would like to see what else you are able to do with the package to suit your needs.

JSON database seeder

The database seeder in this package

are designed to seed a table from a json data file.

Usage

All what you have to do is to integrate DatabaseJsonSeeder in Database\Seeder\DatabaseSeeder

After that, enter the models to be considered by the JsonSeeder into config/make-commands.php and configure the paths to the seeder classes and the seeder data files, below the key seeders. The order of the models must be specified according to the dependencies.

The JsonSeeder classes will be created automatically if they do not exist yet.

Now you need to create the data files in JSON format. The file name must match the table name of the model.

Here is an example for the User Model.

database/seeders/data/users.json

After that, you can run the seeders with

Create JSON datafiles from database (make-commands:seeder-data)

You can create the seeder JSON datafile directly from the database.

Use therefor the command

Example

This creates the files users.json and user_posts.json into the configured seeder data directory.

Extend Eloquent model to use views

The UseView Trait allows to create eloquent models based on Views, which are

are.

Eloquent models must exist for the underlying tables of the View.

The Model must extend ViewModel and must define at least the three attributes:

The ViewModel adds the following properties and methods to the Model.

Example

IDE - Helper Support for View model

Because Eloquent and Doctrine did not run back the columns of a view, two problems arise:

For the second point there is the artisan command make-commands:view-model-hook in this package which creates a hook class in the directory app/Support/IdeHelper. This must then only be entered in the IDE-Helper config file under hooks.

Credits


All versions of laravel-make-commands with dependencies

PHP Build Version
Package Version
Requires eventsauce/object-hydrator Version 1.4.0
laravel/framework Version 10.48.22
monolog/monolog Version 3.7.0
spatie/laravel-package-tools Version 1.16.4
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 jfheinrich-eu/laravel-make-commands contains the following files

Loading the files please wait ....