php-gear / auto-client
A command-line tool to generate Javascript client-side APIs from REST PHP APIs
Requires
- php: >=7
This package is auto-updated.
Last update: 2025-04-13 01:04:54 UTC
README
A command-line tool to generate Javascript client-side APIs from REST PHP APIs
Introduction
This package provides a command-line tool for use either with the Laravel framework (as an Artisan command) or with the Electro framework (as a Workman command).
TO DO: provide an explanation of the rationale behind this library and some usage examples.
Note: currently, this tool generates code for use with AngularJS 1.x, and it expects an Angular service called
remote
of typeRemoteService
.This requirement is temporary and it will be removed on a later version of this tool.
Documentation
Additional documentation will be written, as soon as I find the time for it.
Installation
Runtime requirements
- PHP >= 7.0
- AngularJS 1.x
Optionally, one of
- Laravel >= 4.2
- Electro >= 1.0
Installing on Laravel
On the command-line, type:
composer require php-gear/auto-client
Register the Artisan command on artisan.php
:
Artisan::resolve (PhpGear\AutoClient\Laravel\AutoClientCommand::class);
Installing on Electro
workman install php-gear/auto-client
Usage
On Laravel
Configuring
On config/app.php
, define the APIs to be exported to Javascript.
Example:
return [ 'autoclient' => [ 'APIs' => [ // Endpoint URL => [controller class, target directory, Angular module name] 'API/something' => [SomethingController::class, 'App/remote', 'App'], ], ], ///... the rest of the existing file ];
Running the generator
artisan autoclient:generate
On Electro
Running the generator
workman autoclient:generate
License
This library is open-source software licensed under the MIT license.
See the accompanying LICENSE
file.
Copyright © 2018 Cláudio Silva