vcarreira/wordsapi-laravel

A simple WordsAPI service provider for Laravel 5
137 3
Install
composer require vcarreira/wordsapi-laravel
Latest Version:1.0
PHP:>= 5.5.9
License:MIT
Last Updated:Feb 12, 2016
Links: GitHub  ·  Packagist
Maintainer: vcarreira

WordsApi

A simple Laravel 5 service provider for the WordsApi service.

Installation

Add the following line to the require section of composer.json:

{
    "require": {
        "vcarreira/wordsapi-laravel": "~1.0"
    }
}

Setup

In /config/app.php, add the following to providers:

WordsApi\WordsApiServiceProvider::class,

and the following to aliases:

'WordsApi' => WordsApi\Facades\WordsApi::class,

Configuration

In order to use the service you must first get an API key from WordsAPI. By default, the package uses the following environment variables to auto-configure the service without modification:

WORDSAPI_API_KEY

To customize the configuration file, publish the package configuration using Artisan.

php artisan vendor:publish --provider="WordsApi\WordsApiServiceProvider"

Update your settings in the generated app/config/wordsapi.php configuration file.

Usage

To use the service within your app, you need to retrieve it from the Laravel IoC Container. The following example uses the app helper to retrieve information about the word 'effect'.

    $word = app('wordsapi')->word('effect');
    var_dump($word->definitions());
    var_dump($word->synonyms());
    var_dump($word->rhymes());
    var_dump($word->pronunciation());

If the facade is registered within the aliases section of the application configuration, you can also use the following code:

    $word = WordsApi::word('effect');
    var_dump($word->definitions());
    var_dump($word->synonyms());
    var_dump($word->rhymes());
    var_dump($word->pronunciation());

Limitation

Version 1.0 does not support search requests.

Links

Related Packages

adobradi/laravel5-elastic

Simple Elastic wrapper for Laravel 5

2,089 1
davispeixoto/laravel5-salesforce

Laravel 5 Salesforce Force.com PHP Toolkit port

143,225 47
sboo/laravel5-mailjet

Mailjet driver for Laravel 5

4,593 15
sh0umik/laravel5-mailjet-5.3-fix

Mailjet driver for Laravel 5 with 5.3 Fix

781 0