claromentis/opauth

Multi-provider authentication framework for PHP

1.0.3 2022-07-14 16:36 UTC

README

Opauth is a multi-provider authentication framework for PHP.

Opauth enables PHP applications to perform user authentication really easily.

Try out Opauth for yourself at http://opauth.org

Notes on 1.0.x

1.0.x is currently under preview release and not to be used for production yet. See release notes for details.

Opauth API and functionalities are fully ready for evaluation. Please try it out and let us know what you think.

1.0.x is not backward-compatible with 0.x. See migration guide on how to migrate Opauth 0.x applications and strategies.

For current stable release, see 0.4.x.

Build Status Coverage Status

What is Opauth?

Opauth provides a standardized interface between PHP applications and authentication providers.

Opauth as a framework provides a set of API that allows developers to create strategies that work in a predictable manner across PHP frameworks and applications.

Opauth works well with other PHP applications & frameworks.

Quick start

  1. Composer require Opauth core and Opauth strategies. Add the following to your application's composer.json:

    {
        "minimum-stability": "dev",
        "require": {
            "opauth/opauth": "~1.0",
            "opauth/facebook": "~1.0"
        }
    }

    Note: While Opauth 1.0.x still is in development, your root composer.json will need to set its minimum-stability to dev.

    Install them

    $ composer install
  2. Configure Opauth.
    Create a file opauth.php that is accessible at http://localhost/opauth.php/.

    <?php
    $config = array(
        'Strategy' => array(
            'Facebook' => array(
                'app_id' => 'YOUR APP ID',
                'app_secret' => 'YOUR APP SECRET'
            )
        ),
        'path' => '/opauth.php/'
    );
  3. Instantiate and run Opauth

    <?php
    $Opauth = new Opauth\Opauth\Opauth($config);
    
    try {
        $response = $Opauth->run();
        echo "Authed as " . $response->name . " with uid" . $response->uid;
    } catch (OpauthException $e) {
        echo "Authentication error: " . $e->getMessage();
    }
  4. Point your browser to http://localhost/opauth.php/facebook to see it in action.

References

See Opauth documentations for more infomation.

Requirements

Core contributors

  1. U-Zyn Chua (@uzyn on GitHub & Twitter)
  2. Marc Ypes (@ceeram on GitHub & Twitter)

We welcome your contributions to Opauth:

  • Be free to submit pull requests.
  • Inform Opauth community via the discussion group and/or @opauth if you have authored a new strategy, new plugin or done anything cool with Opauth.
  • Join us at IRC: #opauth on Freenode for any discussions.

Issues & questions

License

The MIT License
Copyright © 2012-2014 U-Zyn Chua (http://uzyn.com)

Credits

  • OmniAuth for Ruby – The project that inspired Opauth.
  • Homenaje – The font for Opauth logo. Designed by Constanza Artigas Preller and Agustina Mingote. SIL Open Font Licence, 1.1.