Giter Site home page Giter Site logo

jorbascrumps / php-api-wrapper Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cristalteam/php-api-wrapper

0.0 1.0 0.0 147 KB

:rainbow: Work with APIs like with Laravel Eloquent or Doctrine (no longer a dream)

License: MIT License

PHP 100.00%

php-api-wrapper's Introduction

PHP API Wrapper

Latest Stable Version GitHub issues GitHub license

PHP API Wrapper is a smart stack based on a couple of a Transport and a smart Wrapper for your API. It is designed to be easily integrated into your projects thanks to bridges for Laravel, Symfony, API Platform and a standalone stack.

๐Ÿš€ Installation using Composer

composer require cristal/php-api-wrapper

๐Ÿ‘€ Quick view

<?php

// Configure your API

use Cristal\ApiWrapper\Model;
use Cristal\ApiWrapper\Transports\Basic;
use App\User;
use Curl\Curl;

$transport = new Basic('username', 'password', 'http://api.example.com/v1/', new Curl);
$api = new Api($transport);

Model::setApi($api);

// Use your model like Eloquent (Usage with Symfony is significantly different)

$activedUsers = User::where(['active' => true])->get();

foreach($activedUsers as $user){
    $user->active = false;
    $user->save();
}

๐Ÿ“– Chose your stack

๐Ÿ‘‰ Start wihout Laravel or Symfony

If you decide to work without Laravel or Symfony, PHP Api Wrapper comes with a standalone Builder and a Model largely inspired by Eloquent, but really standalone. I promise !

Start without Laravel or Symfony

๐Ÿ‘‰ Start with Laravel

This is actualy the powerfull usage of API Wrapper. If you decide to use PHP API Wrapper with Laravel the integration approaches perfection. The builder returns Collections, all models are usable with the Laravel Route Binding (this is really impressive). And icing on the cake, you can create complexes relations between Eloquent and PHP API Wrapper.

Start with Laravel

๐Ÿ‘‰ Start with Symfony (and optionally Api Platform)

This implementation is realy interesting too, the Symfony bridge provide you a Repository implementing the Doctrine RepositoryInterface which hydrates your entities. A Manager is also available which allows you to manage repositories and its connections. If you are using API Platform this is fully compatible. A API Platform Data Provider is also registered.

โš ๏ธ Careful, this implementation is currently read-only. Help us to implement the missing parts !

Start with Symfony

php-api-wrapper's People

Contributors

camillebaronnet avatar ffouchier avatar mathieufrh avatar tzk- avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.