PHPackages                             hopkins/laravel-aylien-wrapper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. hopkins/laravel-aylien-wrapper

ActiveLibrary[API Development](/categories/api)

hopkins/laravel-aylien-wrapper
==============================

A laravel friendly wrapper around the Aylien PHP SDK

134995[1 PRs](https://github.com/michael-hopkins/Laravel-Aylien-Wrapper/pulls)PHP

Since Apr 5Pushed 7y ago2 watchersCompare

[ Source](https://github.com/michael-hopkins/Laravel-Aylien-Wrapper)[ Packagist](https://packagist.org/packages/hopkins/laravel-aylien-wrapper)[ RSS](/packages/hopkins-laravel-aylien-wrapper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

A Laravel 5 friendly wrapper around the Aylien PHP SDK
------------------------------------------------------

[](#a-laravel-5-friendly-wrapper-around-the-aylien-php-sdk)

[![](https://camo.githubusercontent.com/d38e02e646954c5533aba412f07aed7d730754b493ee2dcfbde8a23afc7256f8/687474703a2f2f692e696d6775722e636f6d2f7a7743536255532e706e67)](https://camo.githubusercontent.com/d38e02e646954c5533aba412f07aed7d730754b493ee2dcfbde8a23afc7256f8/687474703a2f2f692e696d6775722e636f6d2f7a7743536255532e706e67)

[Aylien](http://aylien.com) is a package consisting of eight different Natural Language Processing, Information Retrieval and Machine Learning APIs that can be adapted to your processes and applications with relative ease. Admittidly this wrapper doesn't add a significant value to their extensive, well documented [PHP SDK](https://github.com/AYLIEN/aylien_textapi_php), as the primary purpose is to provide the facade `Aylien::` to your Laravel 5 app.

---

[![Latest Stable Version](https://camo.githubusercontent.com/1d505090180f207e819c465b57d839ec184ac1b51ac72430a28e33e28be0f6cd/68747470733a2f2f706f7365722e707567782e6f72672f686f706b696e732f6c61726176656c2d61796c69656e2d777261707065722f76657273696f6e2e737667)](https://packagist.org/packages/hopkins/laravel-aylien-wrapper)[![Total Downloads](https://camo.githubusercontent.com/ebe5595cda3956f6dff5f5cd80d58f5578bfbddf41cd49cffaf54459854dc0fb/68747470733a2f2f706f7365722e707567782e6f72672f686f706b696e732f6c61726176656c2d61796c69656e2d777261707065722f646f776e6c6f6164732e737667)](https://packagist.org/packages/hopkins/laravel-aylien-wrapper)[![Latest Unstable Version](https://camo.githubusercontent.com/b72fefb77f902ab9e0e15a52ac38ab13155aafa625222cca6ba27ecd19cb88ad/68747470733a2f2f706f7365722e707567782e6f72672f686f706b696e732f6c61726176656c2d61796c69656e2d777261707065722f762f756e737461626c652e737667)](//packagist.org/packages/hopkins/laravel-aylien-wrapper)[![License](https://camo.githubusercontent.com/895f4e3480eac57864a3260c228bccc3351793f80750527f41f040f4a889ef49/68747470733a2f2f706f7365722e707567782e6f72672f686f706b696e732f6c61726176656c2d61796c69656e2d777261707065722f6c6963656e73652e737667)](https://packagist.org/packages/hopkins/laravel-aylien-wrapper)[![SensioLabsInsight](https://camo.githubusercontent.com/74db53e03d4eeafc692b3fd07fc0b93352eab3f36791ce3fdff6b7bb83195068/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f34373664613061352d643039312d346663622d383131352d6430373736356232323134652f6d696e692e706e67)](https://insight.sensiolabs.com/projects/476da0a5-d091-4fcb-8115-d07765b2214e)

---

\#Installation

Require this package in your `composer.json` and update composer. Run/add either of the below two commands

```
"hopkins/laravel-aylien-wrapper": "dev-master"
```

or

```
composer require hopkins/laravel-aylien-wrapper=dev-master
```

After updating composer, add the ServiceProvider to the providers array in `app/config/app.php`

```
'Hopkins\LaravelAylienWrapper\Providers\AylienServiceProvider',
```

and the facade into your array of facades

```
'Aylien'    => 'Hopkins\LaravelAylienWrapper\Facades\Aylien',
```

Run the artisan command to bring the config into your project

```
php artisan vendor:publish
```

I put my api keys in the .env file. To use this style of config you can copy the below into your `config/aylien.php`

```
return [
    'app_id' => env('API_AYLIEN_APP_ID'),
    'app_key' => env('API_AYLIEN_APP_KEY')
];
```

---

\#How to use

Aylien provides a number of great examples on their site, as well as [terrific documentation](https://developer.aylien.com/getting-started/php). However I'd feel bad if I didn't at least provide one example. The example at the bottom of the readme uses the Sentiment analysis, however all of the following are available for use

```
Aylien::Sentiment();
Aylien::Extract();
Aylien::Classify();
Aylien::Concepts();
Aylien::Hashtags();
Aylien::Entities();
Aylien::Language();
Aylien::Related();
Aylien::Summarize();
Aylien::Microformats();
Aylien::UnsupervisedClassify();
```

Let's say you want to log all messages you receive from a chat/email client/contact form. You'd have a `Message.php` model in this case that saved to your database. By adding a `public static function boot()` method we can utilize Laravel's [model events](http://laravel.com/docs/master/eloquent#model-events) to make sure first we get the message into the db, and then take the time to call Aylien's API. The below example is using the Sentiment anaylisis

```
class Message extends BaseModel
{
    protected $guarded = ['id'];
    public static function boot()
    {
        parent::boot();
        Message::created(function(Message $message)
        {
            $aylienResponse = \Aylien::Sentiment(['text'=>$message->message]);
            $message->update([
                'polarity' => $aylienResponse->polarity,
                'polarity_confidence' => $aylienResponse->polarity_confidence,
                'subjectivity' => $aylienResponse->subjectivity,
                'subjectivity_confidence' => $aylienResponse->subjectivity_confidence
            ]);
        });
    }
}
```

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity22

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/46a413ff06833668c1a7ce60ad577cf0e5c774f7ac1934f478a7287091f7314c?d=identicon)[michael-hopkins](/maintainers/michael-hopkins)

---

Top Contributors

[![michaeljhopkins](https://avatars.githubusercontent.com/u/4623657?v=4)](https://github.com/michaeljhopkins "michaeljhopkins (2 commits)")[![chris-redbeed](https://avatars.githubusercontent.com/u/7247625?v=4)](https://github.com/chris-redbeed "chris-redbeed (1 commits)")

### Embed Badge

![Health badge](/badges/hopkins-laravel-aylien-wrapper/health.svg)

```
[![Health](https://phpackages.com/badges/hopkins-laravel-aylien-wrapper/health.svg)](https://phpackages.com/packages/hopkins-laravel-aylien-wrapper)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
