PHPackages                             lexismith/laravel-alchemy - 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. lexismith/laravel-alchemy

ActiveLibrary[API Development](/categories/api)

lexismith/laravel-alchemy
=========================

Package for Laravel integration with Alchemy API

124.8k↑94.7%PHP

Since Feb 13Pushed 9y ago2 watchersCompare

[ Source](https://github.com/alexandrasmith00/laravel-alchemy)[ Packagist](https://packagist.org/packages/lexismith/laravel-alchemy)[ RSS](/packages/lexismith-laravel-alchemy/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Alchemy API Service Provider for Laravel 5
==========================================

[](#alchemy-api-service-provider-for-laravel-5)

This is a [Laravel](http://laravel.com/) service provider for making it easy to include the [Alchemy API for PHP](https://github.com/AlchemyAPI/alchemyapi_php) in a Laravel application.

Installation
------------

[](#installation)

The Alchemy Service Provider can be installed via [Composer](http://getcomposer.org) by requiring the `lexismith/laravel-alchemy` package in your project's `composer.json`.

```
	{
		"require": {
			"lexismith/laravel-alchemy": "dev-master"
		}
	}
```

Then run a composer update

```
php composer.phar update
```

To use the Alchemy Service Provider, you must register the provider when bootstrapping your Laravel application.

Find the `providers` key in your `config/app.php` and register the service provider.

```
    'providers' => array(
        // ...
    		'LexiSmith\LaravelAlchemy\AlchemyServiceProvider',
    )
```

Find the `aliases` key in your `config/app.php` and add the Alchemy facade alias.

```
    'aliases' => array(
        // ...
        'Alchemy' 	=> 'LexiSmith\LaravelAlchemy\AlchemyFacade',
    )
```

Configuration
-------------

[](#configuration)

By default, the package uses the following environment variables to auto-configure the plugin without modification:

```
API_KEY
BASE_URL

```

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

```
php artisan vendor:publish
```

Update your settings in the generated `app/config/alchemy.php` configuration file or by editing your environment variables accordingly in `.env`

```
return [
		'url' => env('ALCHEMY_URL', 'http://access.alchemyapi.com/calls'),
		'key' => env('ALCHEMY_API_KEY')
];
```

Usage
-----

[](#usage)

All functions accept three parameters:

1. `$flavor` that describes the type of content being passed. For each function, the options for `$flavor` are given.
2. `$data` that is given in the form of the `$flavor`.
3. `$options` that specify options for each specific function, as described below.

#### Emotion

[](#emotion)

Tags the concepts for test, a URL, or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#emotion_analysis).

```
	$emotions = Alchemy::emotion($flavor, $data, $options);

```

Available flavors:

- `'text'`
- `'html'`
- `'url'`

Available options:

- maxRetrieve -&gt; the maximum number of concepts to retrieve (default: 8)
- linkedData -&gt; include linked data, 0: disabled, 1: enabled (default)
- showSourceText -&gt; 0:disabled (default), 1: enabled

#### Entities

[](#entities)

Extracts the entities for text, a URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#entities).

```
	$emotions = Alchemy::entities($flavor, $data, $options);

```

Available flavors:

- `'text'`
- `'html'`
- `'url'`

Available options:

- disambiguate -&gt; disambiguate entities (i.e. Apple the company vs. apple the fruit). 0: disabled, 1: enabled (default)
- linkedData -&gt; include linked data on disambiguated entities. 0: disabled, 1: enabled (default)
- coreference -&gt; resolve coreferences (i.e. the pronouns that correspond to named entities). 0: disabled, 1: enabled (default)
- quotations -&gt; extract quotations by entities. 0: disabled (default), 1: enabled.
- sentiment -&gt; analyze sentiment for each entity. 0: disabled (default), 1: enabled. Requires 1 additional API transction if enabled.
- showSourceText -&gt; 0: disabled (default), 1: enabled
- maxRetrieve -&gt; the maximum number of entities to retrieve (default: 50)

#### Keywords

[](#keywords)

Extracts the keywords for text, a URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#keywords).

```
	$emotions = Alchemy::keywords($flavor, $data, $options);

```

Available flavors:

- `'text'`
- `'html'`
- `'url'`

Available options:

- keywordExtractMode -&gt; normal (default), strict
- sentiment -&gt; analyze sentiment for each keyword. 0: disabled (default), 1: enabled. Requires 1 additional API transaction if enabled.
- showSourceText -&gt; 0: disabled (default), 1: enabled.
- maxRetrieve -&gt; the max number of keywords returned (default: 50)

#### Concepts

[](#concepts)

Tags the concepts for text, a URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#concepts).

```
	$emotions = Alchemy::keywords($flavor, $data, $options);

```

Available flavors:

- `'text'`
- `'html'`
- `'url'`

Available options:

- maxRetrieve -&gt; the maximum number of concepts to retrieve (default: 8)
- linkedData -&gt; include linked data, 0: disabled, 1: enabled (default)
- showSourceText -&gt; 0:disabled (default), 1: enabled

#### Sentiment

[](#sentiment)

Calculates the sentiment for text, a URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#sentiment).

```
	$emotions = Alchemy::sentiment($flavor, $data, $options);

```

Available flavors:

- `'text'`
- `'html'`
- `'url'`

Available options:

- showSourceText -&gt; 0: disabled (default), 1: enabled

#### Targeted Sentiment

[](#targeted-sentiment)

Analyzes sentiment for targeted phrases via text, a URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#targeted_sentiment).

```
	$emotions = Alchemy::sentiment_targeted($flavor, $data, $target, $options);

```

Additional input:

- target -&gt; the word or phrase to run sentiment analysis on.

Available flavors:

- `'text'`
- `'html'`
- `'url'`

Available options:

- showSourceText -&gt; 0: disabled (default), 1: enabled

#### Cleaned Text

[](#cleaned-text)

Extracts the cleaned text (removes ads, navigation, etc.) for text, a URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#text_cleaned).

```
	$emotions = Alchemy::text($flavor, $data, $options);

```

Available flavors:

- `'text'`
- `'html'`
- `'url'`

Available options:

- useMetadata -&gt; utilize meta description data, 0: disabled, 1: enabled (default)
- extractLinks -&gt; include links, 0: disabled (default), 1: enabled.

#### Raw Text

[](#raw-text)

Extracts the raw text (includes ads, navigation, etc.) for text, a URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#text_raw).

```
	$emotions = Alchemy::text_raw($flavor, $data, $options);

```

Available flavors:

- `'text'`
- `'html'`
- `'url'`

Available options:

- none

#### Author

[](#author)

Extracts the author from URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#authors).

```
	$emotions = Alchemy::author($flavor, $data, $options);

```

Available flavors:

- `'html'`
- `'url'`

Available options:

- none

#### Language Detection

[](#language-detection)

Detects the language for text, a URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#language).

```
	$emotions = Alchemy::language($flavor, $data, $options);

```

Available flavors:

- `'text'`
- `'html'`
- `'url'`

Available options:

- none

#### Title

[](#title)

Extracts the title for a URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#title_extraction).

```
	$emotions = Alchemy::title($flavor, $data, $options);

```

Available flavors:

- `'html'`
- `'url'`

Available options:

- useMetadata -&gt; utilize title info embedded in meta data, 0: disabled, 1: enabled (default)

#### Relations

[](#relations)

Extracts the relations for text, a URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#relations).

```
	$emotions = Alchemy::relations($flavor, $data, $options);

```

Available flavors:

- `'text'`
- `'html'`
- `'url'`

Available options:

- sentiment -&gt; 0: disabled (default), 1: enabled. Requires one additional API transaction if enabled.
- keywords -&gt; extract keywords from the subject and object. 0: disabled (default), 1: enabled. Requires one additional API transaction if enabled.
- entities -&gt; extract entities from the subject and object. 0: disabled (default), 1: enabled. Requires one additional API transaction if enabled.
- requireEntities -&gt; only extract relations that have entities. 0: disabled (default), 1: enabled.
- sentimentExcludeEntities -&gt; exclude full entity name in sentiment analysis. 0: disabled, 1: enabled (default)
- disambiguate -&gt; disambiguate entities (i.e. Apple the company vs. apple the fruit). 0: disabled, 1: enabled (default)
- linkedData -&gt; include linked data with disambiguated entities. 0: disabled, 1: enabled (default).
- coreference -&gt; resolve entity coreferences. 0: disabled, 1: enabled (default)
- showSourceText -&gt; 0: disabled (default), 1: enabled.
- maxRetrieve -&gt; the maximum number of relations to extract (default: 50, max: 100)

#### Feeds

[](#feeds)

Detects the RSS/ATOM feeds for a URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#feed_detection).

```
	$emotions = Alchemy::feeds($flavor, $data, $options);

```

Available flavors:

- `'html'`
- `'url'`

Available options:

- none

#### Microformats

[](#microformats)

Extracts the microformats for a URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#microformats).

```
	$emotions = Alchemy::microformats($flavor, $data, $options);

```

Available flavors:

- `'html'`
- `'url'`

Available options:

- none

#### Taxonomy

[](#taxonomy)

Taxonomy classification operations for text, a URL or HTML. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#taxonomy).

```
	$emotions = Alchemy::taxonomy($flavor, $data, $options);

```

Available flavors:

- `'text'`
- `'html'`
- `'url'`

Available options:

- showSourceText -&gt; include the original 'source text' the taxonomy categories were extracted from within the API response. 1: enabled, 0: disabled (default)
- sourceText -&gt; where to obtain the text that will be processed by this API call. --\* cleaned\_or\_raw : cleaning enabled, fallback to raw when cleaning produces no text (default) --\* cleaned : operate on 'cleaned' web page text (web page cleaning enabled) --\* raw : operate on raw web page text (web page cleaning disabled) --\* cquery : operate on the results of a visual constraints query. Note: The 'cquery' http argument must also be set to a valid visual constraints query. --\* xpath : operate on the results of an XPath query. Note: The 'xpath' http argument must also be set to a valid XPath query.
- cquery -&gt; a visual constraints query to apply to the web page.
- xpath -&gt; an XPath query to apply to the web page.
- baseUrl -&gt; rel-tag output base http url (must be uri-argument encoded)

#### Combined Calls

[](#combined-calls)

Combined call for entity, keyword, title, author, taxonomy. For more information, please refer to [the overview](https://www.ibm.com/watson/developercloud/doc/alchemylanguage/) or [the docs](https://www.ibm.com/watson/developercloud/alchemy-language/api/v1/#combined-call).

```
	$emotions = Alchemy::combined($flavor, $data, $options);

```

Available flavors:

- `'text'`
- `'html'`
- `'url'`

Available options:

- extract -&gt; Possible values: entity, keyword, title, author, taxonomy (default: entity, keyword, taxonomy, concept)
- disambiguate -&gt; disambiguate detected entities. 1: enabled (default), 0: disabled
- linkedData -&gt; include Linked Data content links with disambiguated entities. 1: enabled (default), 0: disabled
- coreference -&gt; resolve he/she/etc coreferences into detected entities. 1: enabled (default), 0: disabled
- quotations -&gt; enable quotations extraction. 1: enabled, 0: disabled (default)
- sentiment -&gt;enable entity-level sentiment analysis. 1: enabled, 0: disabled (default)
- showSourceText -&gt; include the original 'source text' the entities were extracted from within the API response. 1: enabled, 0: disabled (default)
- maxRetrieve -&gt; maximum number of named entities to extract. default : 50
- baseUrl -&gt; rel-tag output base http url

Links
-----

[](#links)

- [Alchemy language](https://www.ibm.com/watson/developercloud/alchemy-language.html)
- [Alchemy API for PHP](https://github.com/AlchemyAPI/alchemyapi_php)
- [Laravel website](http://laravel.com/)
- [License](http://aws.amazon.com/apache2.0/)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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/83e45f51aedd7bdd11e0b56719db16c3a18541ba82ce584f3fba2abea54bb325?d=identicon)[lexismith](/maintainers/lexismith)

---

Top Contributors

[![alexandrasmith00](https://avatars.githubusercontent.com/u/6541433?v=4)](https://github.com/alexandrasmith00 "alexandrasmith00 (7 commits)")

### Embed Badge

![Health badge](/badges/lexismith-laravel-alchemy/health.svg)

```
[![Health](https://phpackages.com/badges/lexismith-laravel-alchemy/health.svg)](https://phpackages.com/packages/lexismith-laravel-alchemy)
```

###  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)[facebook/php-business-sdk

PHP SDK for Facebook Business

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

PHP wrapper for the Meilisearch API

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

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

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