Download the PHP package alexpensato/laravel-api-maker without Composer

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

Laravel Api Maker

Automate the generation of your REST APIs with the console generator command make:api

Introduction

This package is an extended version of the laravel-api-generator package. It includes a completely rewritten BaseController, now renamed to ApiController. This package also presents two new controller types: ReadOnlyController, for APIs that don't need writing capabilities; and WebController, for applications that need support for frontend scaffolding views.

This package relies on the Repository Design Pattern, which means that Controllers will access Models through a Repository interface, which provides better separation of concerns for data access methods and business rules. This repository implementation was inspired by Connor Leech's and Jeff Decena's articles.

This package also uses Codeception/Specify and Codeception/Verify packages to get you started with BDD-style unit testing.

This enhanced version of the console generator creates the following files for each Model in one single command:

  1. ApiController extended class

  2. Fractal Transformer class

  3. Repository interface

  4. Repository implementation class

  5. Unit test file configured for BDD

It also modifies the following configuration files:

  1. Adds routes to routes/api.php

  2. Adds repository binding to ApiServiceProvider

This package was designed to get you started with professional REST API best practices.

Compatibility

Laravel API Maker Laravel
1.0.x 5.6
1.1.x 5.7

Installation

Step 1 - Run

Step 2 - Copy the ApiServiceProvider class to app/Providers folder:

and check what you got there.

Step 3 - Register the service providers in the config/app.php configuration file

Step 4 - Laravel already provides an API routes file. To correctly configure the console generator automation process, you need to choose one of the routing templates presented in vendor/alexpensato/laravel-api-maker/templates/routes/api.php, and then copy it to your project's api routing file.

For instance, copy the code below to the end of your routes/api.php project file.

It will allow the console generator to automatically inject resources routes to the api routing file.

Usage

Generator

The only console command that is added and needed is .

Imagine you need to create a rest api to list/create/update etc. users from users table. To achieve that you need to do lots of boilerplate operations - create controller, transformer, repository, unit testing, set up needed routes and configuring repository binding.

does all the work for you.

It is important to notice that this command assumes that Model has already been created in the Models folder.

For instance, you can create a Model using the following command:

Conventions

You may have noticed that the Controller which has just been generated includes two public methods: __constructor() and transformer(). That's because those methods are the only thing that you need in your controller to set up a basic REST API.

The list of routes that are available out-of-the-box:

  1. GET api/v1/users
  2. GET api/v1/users/{id}
  3. POST api/v1/users
  4. PUT api/v1/users/{id}
  5. DELETE api/v1/users/{id}

Request and response formats are JSON. Response format is defined by Fractal.

Fractal includes are supported via $_GET['include'].

Validation rules for create and update can be set by overwriting rulesForCreate and rulesForUpdate in your controller.

Contributions

…are always welcome. Don’t hesitate to submit a bug report or a pull request.

When filling a bug report or submitting a new feature, please try including supporting test cases.

License

This project is licensed under MIT license.

Although it is a tested package, use at your risk!


All versions of laravel-api-maker with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1.3
ext-json Version ^1.6
illuminate/support Version ^5.6
guzzlehttp/guzzle Version ^6.3
league/fractal Version ^0.17
codeception/specify Version ^1.1
codeception/verify Version ^1.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 alexpensato/laravel-api-maker contains the following files

Loading the files please wait ....