Download the PHP package yarri/essence without Composer

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

Essence

Build status Scrutinizer Code Quality Code Coverage Total downloads

Essence is a simple PHP library to extract media information from websites, like youtube videos, twitter statuses or blog articles.

If you were already using Essence 2.x.x, you should take a look at the migration guide.

Installation

Example

Essence is designed to be really easy to use. Using the main class of the library, you can retrieve information in just those few lines:

Then, just do anything you want with the data:

What you get

Using Essence, you will mainly interact with Media objects. Media is a simple container for all the information that are fetched from an URL.

Here are the default properties it provides:

These properties were gathered from the OEmbed and OpenGraph specifications, and merged together in a united interface. Based on such standards, these properties should be a solid starting point.

However, "non-standard" properties can and will also be setted.

Here is how you can manipulate the Media properties:

Note that Essence will always try to fill the html property when it is not available.

Advanced usage

The Essence class provides some useful utility functions to ensure you will get some information.

Extracting URLs

The crawl() and crawlUrl() methods let you crawl extractable URLs from a web page, either directly from its source, or from its URL (in which case Essence will take care of fetching the source).

For example, here is how you could get the URL of all videos in a blog post:

You can then get information from all the extracted URLs:

Replacing URLs in text

Essence can replace any extractable URL in a text by information about it. By default, any URL will be replaced by the html property of the found Media.

But you can do more by passing a callback to control which information will replace the URL:

This makes it easy to build rich templates or even to integrate a templating engine:

Configuring providers

It is possible to pass some options to the providers.

For example, OEmbed providers accepts the maxwidth and maxheight parameters, as specified in the OEmbed spec.

Other providers will just ignore the options they don't handle.

Configuration

Essence currently supports 68 specialized providers:

Plus the OEmbed and OpenGraph providers, which can be used to extract any URL.

You can configure these providers on instanciation:

You can also disable the default ones:

You will find the default configuration in the standard DI container of Essence (see the following part).

Customization

Almost everything in Essence can be configured through dependency injection. Under the hoods, the constructor uses a dependency injection container to return a fully configured instance of Essence.

To customize the Essence behavior, the easiest way is to configure injection settings when building Essence:

The default injection settings are defined in the Standard container class.

Try it out

Once you've installed essence, you should try to run ./cli/essence.php in a terminal. This script allows you to test Essence quickly:

Third-party libraries

If you're interested in embedding videos, you should take a look at the Multiplayer lib. It allows you to build customizable embed codes painlessly:


All versions of essence with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5.0
essence/dom Version ~1.0.0
essence/http Version ~1.0.0
fg/parkour Version ~1.1.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 yarri/essence contains the following files

Loading the files please wait ....