1. Go to this page and download the library: Download fg/essence library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fg / essence example snippets
$Essence = new Essence\Essence();
$Media = $Essence->extract('http://www.youtube.com/watch?v=39e3KYAmXK4');
if ($Media) {
// That's all, you're good to go !
}
// through dedicated methods
if (!$Media->has('foo')) {
$Media->set('foo', 'bar');
}
$value = $Media->get('foo');
// or directly like a class attribute
$Media->customValue = 12;
$Essence = new Essence\Essence([
// the SoundCloud provider is an OEmbed provider with a specific endpoint
'SoundCloud' => Essence\Di\Container::unique(function($C) {
return $C->get('OEmbedProvider')->setEndpoint(
'http://soundcloud.com/oembed?format=json&url=:url'
);
}),
'filters' => [
// the SoundCloud provider will be used for URLs that matches this pattern
'SoundCloud' => '~soundcloud\.com/[a-zA-Z0-9-_]+/[a-zA-Z0-9-]+~i'
]
]);
$Essence = new Essence\Essence([
// the container will return a unique instance of CustomHttpClient
// each time an HTTP client is needed
'Http' => Essence\Di\Container::unique(function() {
return new CustomHttpClient();
})
]);
$Multiplayer = new Multiplayer\Multiplayer();
if ($Media->type === 'video') {
echo $Multiplayer->html($Media->url, [
'autoPlay' => true,
'highlightColor' => 'BADA55'
]);
}