Download the PHP package alirah/laravel-rest without Composer

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

Laravel Rest

This is a Laravel Package to build RESTFUL API much easier. This package supports Laravel 5.8+.

With this package you can build all the things needed for RESTFUL API with only one command. Such as Controller, Resource, Request, Model, Migration, Seeder, Factory, Route, Test and swagger. Moreover, you can delete it as well.


List of contents


Install

Via Composer

Configure

If you are using Laravel 5.5 or higher than you don't need to add the provider and alias. (Skip to b)

a. In your config/app.php file add these two lines.

b. then run the command in below to publish config/laravel-rest.php file in your config directory :

After running the command , you can set your desired configuration.



Swagger

In order to use Swagger, you need to follow these steps:

a. Run this command:

b. Next, publish config/views from Service Provider:

c. Copy the code in below then paste it to the top of the Controller class in App\Http\Controller\Controller :

At the end, your controller must be like this:

d. Turn swagger field to true in your config\laravel-rest.php:

e. To generate your swagger run:

By default, the swagger route is 'api/documentation' but you can change it in config/l5-swagger.php. To see the full documentation you can check https://github.com/DarkaOnLine/L5-Swagger.


Testing

To get better results we suggest to use sqlite database for your tests. To use sqlite follow these steps:

a. First uncomment the DB_CONNECTION line in phpunit.xml in the root folder

b. Change the sqlite database path in config/database.php:

c. Create a file database.sqlite in database folder

d. To run your tests run command:


How to use

Create

To create a rest recourse, you should run:

This Command create these files:

Delete

To delete a rest recourse, you should run:

This Command delete these files:

Versioning

For versioning you can put prefix for your swagger routes in your config:

Versioning Create

TO create version resource You can run:

This Command create these files:

Versioning Delete

To delete a version resource You can run:

This Command delete these files:

Rest Facade

The Rest facade is used for return JsonResource in controller.

Available methods for Rest facade:

The $data should be Laravel resource or an array

Example

When enable swagger and run this is the result:

app\Models\Blog.php

app\Http\Controllers\Blog\BlogController.php

app\Http\Request\Blog\StoreRequest.php

app\Http\Request\Blog\UpdateRequest.php

app\Http\Resource\Blog\BlogResource.php

database\migrations\...create_blogs_table.php

database\factories\BlogFactory.php

database\seeders\BlogSeeder.php

tests\Feature\Blog\BlogTests.php

routes/api.php


Change log

Please see CHANGELOG for more information on what has been changed recently.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-rest 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 alirah/laravel-rest contains the following files

Loading the files please wait ....