Showcase for black-bits/laravel-api-consumer package

This is an example implementation for the package black-bits/laravel-api-consumer.

It demonstrates the currently implemented functionality by consuming two simple APIs.

Installation

Clone this repository

git clone https://github.com/black-bits/laravel-api-consumer-showcase.git

Navigate into the project directory and install composer requirements

composer install

Copy the env example and generate a key (if you are using Windows replace cp with copy)

cp .env.example .env
php artisan key:generate

What now?

  • We have implemented two simple APIs (IEX Trading API and JSONPlaceholder)
  • IEX Trading API does not offer full REST capabilities. We make use of our CollectionCallbacks to filter/search Companies by Symbol or Name
  • JSONPlaceholder API offers a straight forward REST API that returns demo data. We have implemented a where Method in our Endpoint
  • All the API related code is located in the app/ApiConsumers directory
  • The SymbolEndpoint has caching enabled (10 min)

Commands

The Following commands are used to create new Consumers, Endpoints and CollectionCallbacks

php artisan make:api-consumer MyAPI
php artisan make:api-consumer-endpoint UserEndpoint -c MyAPI
php artisan make:api-consumer-collection-callback ReceivesNewsletter

Feedback

If you have any questions or feedback feel free to contact us at hello@blackbits.io.