Download the PHP package emeguan/laravel-resources without Composer

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

Laravel API Resources

Adds extra functionality to the Laravel Eloquent: API Resources, allowing you to choose attributes and relationships to return via url

Introduction

When we create a JSON API from Laravel we can do it in many ways, the most used way (I think) is to create a Rest API. We can use the json:api specification if we want or use one of the great libraries already available for Laravel such as:

But it is possible that our API with the standard methods of a Rest API is not enough and we prefer to have extra parameters with which to perform different queries on the data before returning it in JSON format.
In this case we can generate our queries with Eloquent and return the data with the toJson method.
With the use of the Laravel Eloquent: API Resources we can control which attributes and relationships we want to return for each model in a static way. With this small library that we have here we can modify the API Resources dynamically from parameters in the url.

Instalation

Install using Composer

Requirements

I have not tested it but it should work with any version of Laravel that includes Eloquent API Resources, that is, Laravel 5.5 and later.
The code has been tested with Laravel 9

Use

Model

Controller

Call

http://laravel-resource.local/as

http://laravel-resource.local/a/1

Documentation

In the url we can specify the attributes we want from a model and the relationships to include. Let's see this with an example.
We start from these 5 models:

If attributes are not specified all are returned.
All relations are included with the dot notation, in the example it is not necessary to specify include=bs,bs.cs

TODO

Something similar to this could be returned where the 1st level relationship did not appear

License

Laravel API Resources is open-source software licensed under the MIT license.


All versions of laravel-resources with dependencies

PHP Build Version
Package Version
Requires php Version >=7.0.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 emeguan/laravel-resources contains the following files

Loading the files please wait ....