Download the PHP package dilneiss/laravel-api-tool-kit without Composer

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

Laravel API tool kit

Laravel api tool kit is a set of tools that will help you to build a fast and well-organized API using laravel best practices.

Contents

Installation

Api response

Dynamic Pagination

Filters

Api Generator

Actions

Media Helper

Enum

General tips

Installation

to publish config

use exception handler to standardize the error response Error Response

in App\Exceptions\Handler class extend the APIHandler class

use API Response Trait in Controller

App\Http\Controllers\Controller.php:

check : API response

🔝 Back to contents

API Response

it is used to format your response to standard format and status codes for success responses, it will be

Success Response

Error Response

usage: you can use the trait inside the class you want to return the response form

and use it like this

Available Methods

🔝 Back to contents

Dynamic Pagination

use pagination dynamically

usage

to use dynamic pagination to get all users :

to get all users without pagination :

to get all users paginated 10 users per page:

by default pagination is 20 element per page you can change the default value from config/api-tool-kit

Filters

usage:

to create a filter class:

to set default filters to the Car model , in Car model you will add

to use it

if you want to override the default filters

options in Filter class

to create a custom query you will just create a new function in the class and add your query example filter by year:

filter by relationship :

🔝 Back to contents

API Generator

Usage :

when you type the command it will ask you whether you want default options :

in addition, the routes will be created and added in routes/api.php files

🔝 Back to contents

Actions

action is a laravel implementation of command design pattern which create a class where you can add your business logic in https://en.wikipedia.org/wiki/Command_pattern

usage:

The best practice to use the action class is to use dependency injection

you have many options 1-use laravel application container

2-inject it in the class in constructor

3-inject the class in laravel controller function

🔝 Back to contents

Media Helper

it is used to upload and delete files to storage

🔝 Back to contents

**Enum

bad practice : if I have two types of users (admin ,student) instead of hard coding the name of user type every time using it you can simply use the enum class

usage :

it will generate classes like this

methods:

🔝 Back to contents

General Tips

throw error instead of return json response

Bad:

good

🔝 Back to contents


All versions of laravel-api-tool-kit with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
illuminate/support Version ^6.20.13|7.30.4|^8.22.2|^9.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 dilneiss/laravel-api-tool-kit contains the following files

Loading the files please wait ....