Giter Site home page Giter Site logo

embedly's Introduction

Embedly

Build Status SensioLabs Insight Coverage Status Scrutinizer Code Quality Total Downloads

Library for embed.ly APIs based on Guzzle 5.

API: emanueleminotto.github.io/Embedly

Install

Install the Embedly library adding emanueleminotto/embedly to your composer.json or from CLI:

$ composer require emanueleminotto/embedly

Read more about the Composer installation here: getcomposer.org/doc/00-intro.md

Usage

This library provides 3 API: embed.ly/docs/api.

Some APIs need an API key you can set in the constructor os using the setApiKey method. The second method of the constructor can be a Guzzle HTTP client to use as an alternative of the default one.

Embed

Options are available at http://embed.ly/docs/api/embed/arguments

For this method the $api_key can be null.

use EmanueleMinotto\Embedly\Client;

$client = new Client($api_key);

$embed = $client->oembed([
    'url' => 'http://www.example.com/',
]);

// enumerated array containing
// arrays like $embed
$embeds = $client->oembed([
    'urls' => [
        'http://www.example.com/',
        'http://www.google.com/'
    ]
]);

Extract

Options are available at http://embed.ly/docs/api/embed/arguments

use EmanueleMinotto\Embedly\Client;

$client = new Client($api_key);

$extracted = $client->extract([
    'url' => 'http://www.example.com/',
]);

// enumerated array containing
// arrays like $extracted
$extracteds = $client->oembed([
    'urls' => [
        'http://www.example.com/',
        'http://www.google.com/'
    ]
]);

Display

The first argument can be NULL, crop, resize or fill.

Options are available at

Currently the url attribute is required.

use EmanueleMinotto\Embedly\Client;

$client = new Client($api_key);

$content = $client->display('resize', [
    'url' => 'http://placehold.it/250x100',
    'color' => '000',
    'height' => 150,
    'width' => 150,
]);

Twig Extension

In this library there's included a Twig extension to allow a simple integration with frameworks.

Functions prefix is: embedly_, arguments are the same of the methods above.

{{ embedly_oembed({url: 'http://www.example.com'}).title }} {# Example Domain #}

embedly's People

Contributors

emanueleminotto avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

embedly's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.