Download the PHP package mediawiki/oauthclient without Composer

On this page you can find all versions of the php package mediawiki/oauthclient. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package oauthclient

Latest Stable Version License

mediawiki/oauthclient

PHP OAuth client for use with Wikipedia and other MediaWiki-based wikis running the OAuth extension.

Installation

$ composer require mediawiki/oauthclient

Usage

For working example code, see the demo directory.

General usage is as follows:

  1. Create a new Client with consumer key that you've registered with the wiki. Setting an user agent is highly encouraged.

    $conf = new ClientConfig( 'https://example.org/w/index.php?title=Special:OAuth' ); $conf->setConsumer( new Consumer( 'e331e186b64a938591e7614170814a75', '9b61abdfa2b88f05670af3919302b12bbc6a6e10' ) ); $conf->setUserAgent( 'MyCoolApp MediaWikiOAuthClient/1.0' ); $client = new Client( $conf );

  2. Retrieve the authentication URL and the Request Token:

    list( $authUrl, $requestToken ) = $client->initiate();

  3. Store the Request Token somewhere and send the user to the authentication URL.

  4. When the user comes back from the wiki they'll arrive at your callback URL, and the query string will contain an oauth_verifier key. Use this to retrieve an Acccess Token:

    $accessToken = $client->complete( $requestToken, $_GET['oauth_verifier'] );

  5. Once you've got an Access Token you can store it and use it to make authenticated requests to the wiki.

    To get the user's identity:

    $ident = $client->identify( $accessToken );

    To make any API call:

    $userInfo = $client->makeOAuthCall( $accessToken, "https://example.org/w/api.php?action=query&meta=userinfo&uiprop=rights&format=json" );

Running tests

composer install --prefer-dist
composer test

History

The code is a refactored version of Stype/mwoauth-php, which in turn is partially based on Andy Smith's OAuth library. Some code is taken from wikimedia/slimapp. See CHANGELOG.md for more details.



All versions of oauthclient with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-curl Version *
ext-json Version *
psr/log Version ^1.0||^2.0||^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mediawiki/oauthclient contains the following files

Loading the files please wait ....