Code Monkey home page Code Monkey logo

php-library's Introduction

Bukwild PHP Library Build Status

This is a bundle designed to work with Laravel but it tries to stay independent where possible.

Contents

  • APIs - Reusable components for working with 3rd party APIs like Twitter
  • Laravel - Reusable components designed to work with Laravel
  • Utils - General framework independent utilities

Installation

  1. Run composer require bkwld/library

  2. Add as a provider in your config/app.php's provider list: 'Bkwld\Library\ServiceProvider',

php-library's People

Contributors

weotch avatar thelucre avatar brokenhd avatar

Stargazers

Olivier Cardoen avatar nebel avatar Maciej Kuś avatar Jens Kleikamp avatar  avatar Brad Gorman avatar Bruno Rocha avatar

Watchers

 avatar Maciej Kuś avatar Matthew Aebersold avatar Timothy Ting avatar Lyle Underwood avatar  avatar James Cloos avatar Michael Anthony avatar  avatar Rachel Ratner avatar  avatar  avatar  avatar  avatar  avatar

php-library's Issues

Composer Support

Hey, are you thinking of writing in composer support? If not do you mind if I fork the project and do so myself?

edit: I notice this is the same question I asked on another of your projects :)

Make APIs testable

Need to switch to use dependency injection. I think that all APIs will extend from a new class, Bkwld\Library\Api\Container. This would have a method called setSession() which I would pass Laravel's $app->make('session') to. Then, all the current static session functions would be switched to instance methods. So to run one one, it woud be like:

$instagram_user = new Bkwld\Library\Api\Instagram\User();
$instagram_user->setSession($app->make('session'));
$feed = $instagram_user->feed();

To make this easier, I add to the Container class a __callStatic magic method. I'm hoping that I can have calls to Bkwld\Library\Api\Instagram\User::feed() make a new instance of Bkwld\Library\Api\Instagram\User and then call the instance feed. If not, I'll make the calls like Bkwld\Library\Api\Instagram\User::getFeed().

To mock the API calls, I should be able to just mock the APIs that have a PHP SDK that you invoke the API with. For APIs where I am CURLing, (like Instagram), I'll add a curl public method to the API container (Bkwld\Library\Api\Instagram->curl($url)) which I can mock. This method responds with a data object containing data (the response) and code (the http code).

Then, to actually run the tests, I'll save the JSON/XML output from the APIs to the test as a string and use that as the mocked response from the API calls.

Add backup caching to API libraries

Make two caches from API results: one is the same one we're using now but the new one is a forever cache with a key that is the same except it's appended with "-forever". Then, when making a cache, if there is an error or exception, return the forever cache and log the error (using, I think it's Error.log so that Codebase is notified) but DON'T throw an exception. Thus, if the API is down or we're rate limited, we return the last cached data rather than an empty set (or an exception).

String class incompatible with PHP7

Deploying to a newly minted Arcus server and getting an error. Should be renamed (see: UnionOfRAD/lithium#1205 (comment))

PHP Fatal error: Cannot use Bkwld\Library\Utils\String as String because 'String' is a special class name in /storage/av03895/artfolio/staging/releases/20160802045315/vendor/bkwld/decoy/classes/Models/Admin.php on line 6

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.