Download the PHP package homesheer/laravel-assembler without Composer

On this page you can find all versions of the php package homesheer/laravel-assembler. 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-assembler

Laravel Assembler

中文说明

For Laravel 5 For Lumen 5 Latest Version on Packagist Total Downloads

Introduction

Laravel Assembler is used to retrieve specifying fields of Eloquent Model or DTO for front-end requests, reducing the need for API interface upgrades.

Requirements

This package requires Laravel 5.4 or newer.

Installation

You can install the package via Composer:

You can publish the config file with:

For Laravel 5.4 or older:

For Lumen:

Usage

1. Instantiate Assembler or a subclass inherited from Assembler and pass in Eloquent model or DTO:

2. Call the getAssembledData method of Assembler to obtain the assembled data:

3. Add the query string fields to the URL and specify the fields to be acquired:

The controller method of request returns the $assembledUserData of the previous step.

Request API interface to specify fields in the fields query string

4. Attributes that do not exist in Eloquent Model or DTO can also be obtained:

Simply create a new class that inherits from Assembler and defines the method of getting the virtual attributes

Then add the virtual field to the request

5. Supports three types of source data: objects with getter methods, objects without getter methods but with public attributes, and associative arrays:

Objects with getter methods:

Objects without getter methods but with public attributes:

Association array:

6. Priority:

The acquired field is retrieved from high to low in the following order until the field terminates and returns null by default if it is not retrieved.

7. Nested Cascade:

In the case of Eloquent Model, natural support is provided for acquiring associated model attributes, as well as customized getter methods or attributes to return objects or arrays.

In the case of DTO, you need to define your own getter method or attribute that returns objects or arrays.

If it's an associative array, it's just a multidimensional associative array.

For response speed, it is not recommended to nest more than five layers.

8. config

If a customized Assembler and maps in config/assembler.php configure the corresponding relationship, the corresponding getter method of getAssembledData is automatically obtained when the getAssembler method is called after instantiating the parent class Assembler.

Contributing

Contributions are welcome, thanks to y'all :)

License

Laravel Assembler is open-sourced software licensed under the MIT license.


All versions of laravel-assembler with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
illuminate/support Version >=5.8
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 homesheer/laravel-assembler contains the following files

Loading the files please wait ....