Download the PHP package s-patompong/hmrc-api-php without Composer

On this page you can find all versions of the php package s-patompong/hmrc-api-php. 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 hmrc-api-php

HMRC API PHP

Build Status StyleCI

This library can be used to connect and does operations on HMRC API https://developer.service.hmrc.gov.uk/api-documentation.

How to use

For global API such as Hello World, you can use HelloWorldRequest class to deal with the API call.

For application-restricted API call such as Hello Application. First set the server token using ServerToken class and then you can use HelloApplicationRequest class to call the API.

For user-restricted API call, please see the next section.

User-Restricted API call

The easiest way to learn about this is by running the local server using php -S localhost:8080 command at the root of this library. And then navigate to http://localhost:8080/examples/index.php on your browser. Don't forget to setup the credentials inside examples/config.php file.

You can gain the access token by create HMRC Oauth2 Provider and redirect to authorize URL (see example/oauth2/create-access-token.php for example).

After user grant authorize on HMRC authorization page, it will redirect back to $callbackUri, which in the example above, the callback.php file.

Content of callback.php

You need to use \HMRC\Oauth2\AccessToken class to get and set access token. The class that do the request will get Access Token from this class.

After get the access token and save it inside \HMRC\Oauth2\AccessToken, we can start calling user-restricted API. For example, here is the request to hello user endpoint.

Change between sandbox and live environment

In default mode, this library will talk with sandbox environment of HMRC. If you want to use live environment, you can call it via Environment singleton.

Development & Contribution

Contributor is more than welcome to help develop this library, all the important methods should have unit test.

To run test, simply call composer test command on terminal.


All versions of hmrc-api-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1
league/oauth2-client Version ^2.4
guzzlehttp/guzzle Version ^6.3
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 s-patompong/hmrc-api-php contains the following files

Loading the files please wait ....