Giter Site home page Giter Site logo

phoauth's Introduction

PhoAuth

Build Status

OAuth sucks. The goal of this library is to make it stop sucking. It's for PHP 5.3+. It is licensed under the New BSD License.

Some libraries...

  • Force the use of HTTP in a rigidly prescribed way
  • Suppress errors, making debugging impossible
  • Have weird names for parameters
  • Are coupled to a single web server with an arc welder
  • Only work as a client OR a server
  • Are written by people who get paid by # of lines of code
  • Work by funnelling gerbils through pneumatic tubes

Check this out:

<?php
use PhoAuth\Utils;

$signer = new PhoAuth\Signer(
    Utils::getServerScheme(),
    Utils::getServerMethod(),
    Utils::getServerHost(),
    Utils::getServerPort(),
    Utils::getServerRequestUri(),
    Utils::getServerHeaders(),
    Utils::getServerInputBody());

echo $signer->getSignature();

The first thing to notice is that all of the HTTP information that PhoAuth needs is passed in. CS 101 has these concepts about encapsulation and separation of concerns--this is an example of that.

The second thing to notice is how easily Utils lets most people work with most PHP set ups. At the same time, due to PhoAuth's design not sucking, it be used with Hurricane, Guzzle, or whatever.

While we're at it, here's how to write a server and a client. Notice the use of custom callbacks to control how data flow and validation works. Also notice how nothing is coupled to the client's actual behavior.

A few other niceties:

  • The implementation is clean and easy to read
  • The code is minimal and cohesive, leaving room to build use-case-specific abstractions
  • Exceptions are specific and detailed
  • Everything is covered by unit tests

Even Cats Like It!

Psyched Cat

The feline above has just spotted PhoAuth and is shocked by how awesome it is.

phoauth's People

Contributors

icheishvili avatar

Stargazers

Hao Wooi Simon Lim avatar

Watchers

James Cloos 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.