Download the PHP package baileyherbert/envato without Composer

On this page you can find all versions of the php package baileyherbert/envato. 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 envato

Envato.php

An API client for Envato in PHP, with simplified OAuth, token storage, and request sending.

Notes

This API client is fully working though not necessarily completed. Of course, any updates that aren't backwards-compatible will be bumped up a major version. Other than that, here's some info you'll probably want to know.

Installation

Include this into your project using Composer. It will be autoloaded.

Authentication

Personal Token

Start a new client with a personal token (create one at build.envato.com).

OAuth

With OAuth, you must redirect your users to Envato's authentication screen, where they will approve your requested permissions. Then, they will be redirected back to your application with a code query parameter that can be used to obtain an API token.

The following example demonstrates a complete OAuth guard that redirects the user and creates a client when they return. It also persists their credentials to a PHP session, so the client can be recreated and the token can be renewed in future requests.

To make this example work, create a new app at the build.envato.com website. The redirect_uri should point directly to the file where the above code is hosted and must be exactly the same both in the code and on the registered Envato App.

Tokens generated in this manner will expire after one hour. However, by using the store callback and load() method as shown above, the client can automatically renew them in the background. When that happens, the store callback will be invoked again with the new credentials.

Sending Requests

Here's an example request to get the current user's username. Currently, it returns a ResultSet object; this object exposes a results property which is an array of the raw API response.

For an endpoint which has variables, you can pass them as an array. This works for all endpoint versions, including legacy v1 and the new v3.

Getting Request Time

To determine how long a request took to execute (in seconds), you can reference the $response->time property.

Rate Limiting

If you're being rate limited, the client will throw a TooManyRequestsException exception. The exception instance has methods to help work with the rate limit.

Custom Requests

If there is a new endpoint which is not yet available in this package, you may use the $request property on the client to manually send the request until it is added.

There are methods available for each request type (get, post, etc). Pass the path as the first parameter. Pass your POST body variables as the second parameter, these will also replace variables in the path denoted by {}.

Catalog

Look up a public collection

Look up a single item

Look up a single WordPress theme/plugin version

Search for items

Search for comments

Popular items by site

Categories by site

Prices for a particular item

New items by site and category

Find featured items

Random new items

Profile

The profile category represents a public Envato user.

List all of current user's collections

Look up a collection by ID

Get a user's profile details

List a user's badges

Get a user's items by site

Get a user's newest items

User

The user category represents the currently-authenticated user.

List an author's sales

Look up a sale by purchase code

List a buyer's purchases

Look up a buyer's purchase by code

Download a buyer's purchase

Get private account details

Get the current user's username

Get the current user's email

Get the user's earnings by month

Get the user's statement

Market

Get total number of users

Get total number of items

Get total number of items by site

Other Endpoints

Get the client's identity

The identity will be an object that looks like this:

If you only care about the userId property, you can retrieve it more easily:

Handling Errors & Exceptions

All exceptions in this libary are under the Herbert\Envato\Exceptions namespace.

Authorization Errors

When performing OAuth authorization, you may encounter one of these exceptions:

Request Errors

When performing a request, there are four possible exceptions that can be thrown.

Otherwise, if an error occurs in the request, it will be accessible in detail using the $response->error property (which is null when successful or a string with error details otherwise).

Examples

Verifying Purchase Codes

If you're an author and want to check a purchase code provided to you from a buyer, this is an example for you. To make this work, you'll want to use Personal Token authentication.

Breaking changes in v3

If upgrading the package to v3 from an earlier version, there is a single breaking change. The user->sales() method was pointing to the wrong endpoint.

Contributors

Special thanks to the following contributors for their help in maintaining this package:


All versions of envato with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
guzzlehttp/guzzle Version ^6.0 || ^7.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 baileyherbert/envato contains the following files

Loading the files please wait ....