Download the PHP package foothing/laravel-repository-controller without Composer

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

Laravel Repository Controller

Easily open an HTTP api over your Laravel database.

Setup

Install with composer:

composer require foothing/laravel-repository-controller

This package will define several routes in a REST-like format that will perform operations on your database.

Add the service provider in config/app.php:

In order to enable the routes, you'll need to declare them in your routes.php:

Be careful and place the RouteInstaller::install() method at the very end of your routes.php in order to avoid conflicts.

IMPORTANT: you will need to change the default Controllers namespace in RouteServiceProvider like so: protected $namespace = '';

Finally, configure your resources in the config file.

This will add the resources.php file in your config folder.

This will enable the routes on the specified resources.

How to use

The RouteInstaller will declare the package routes. You can specify a prefix as an optional install() argument. The process will enable the following routes, which we'll describe in better details later.

VERB Url Notes
GET [optionalPrefix]/resources/{resource}/{id?}/{args?} Read resources
POST [optionalPrefix]/resources/{resource} Create resources
PUT [optionalPrefix]/resources/{resource}/{id} Update resources
DELETE [optionalPrefix]/resources/{resource}/{id} Delete resources
PUT resources/{resource}/{id?}/link/{relation}/{related}/{relatedId} Attach many-to-many
DELETE resources/{resource}/{id?}/link/{relation}/{related}/{relatedId} Detach many-to-many
POST resources/bulk/{resource} Bulk create resources
PUT resources/bulk/{resource} Bulk update resources

Each api endpoint will return data in JSON format.

Read resources

Verb Url Payload
GET [optionalPrefix]/resources/{resource}/{id?}/{args?} none

Examples

Pagination

This endpoint will handle 2 querystring args for pagination:

The result will be a Laravel paginated result like:

Related resources

You can pass an optional with query string argument that will be used to fetch relations within the requested resource:

GET api/v1/resources/user/1?with=roles,posts

Auto eager loading relations

Since this package relies on Laravel Repository you can take advantage of that package eager loading features therefore enabling auto eager-load features on each resource.

Create resources

Create the requested resource.

Verb Url Payload
POST [optionalPrefix]/resources/{resource} {resourceData}

Example

POST api/v1/resources/user

POST payload

HTTP Response

Update resources

Update the requested resource.

Verb Url Payload
PUT [optionalPrefix]/resources/{resource}/{id} {resourceData}

Example

PUT api/v1/resources/user/1

PUT payload

HTTP Response

Delete resources

Delete the requested resource.

Verb Url Payload
DELETE [optionalPrefix]/resources/{resource}/{id} none

Example

DELETE api/v1/resources/user/1

Link, bulk create and bulk update

More info coming soon.

LICENSE

MIT


All versions of laravel-repository-controller with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
illuminate/routing Version ~5.0
foothing/laravel-repository Version >=0.8.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 foothing/laravel-repository-controller contains the following files

Loading the files please wait ....