PHPackages                             motaword/active-laravel - 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. [Localization &amp; i18n](/categories/localization)
4. /
5. motaword/active-laravel

ActiveLibrary[Localization &amp; i18n](/categories/localization)

motaword/active-laravel
=======================

Laravel middleware for MotaWord Active

1.0.0-rc18(2y ago)13.0k↓50%[1 issues](https://github.com/MotaWord/active-laravel/issues)MITPHPPHP &gt;=7.2|^8.2CI failing

Since Dec 15Pushed 1y ago2 watchersCompare

[ Source](https://github.com/MotaWord/active-laravel)[ Packagist](https://packagist.org/packages/motaword/active-laravel)[ Docs](https://github.com/motaword/active-laravel)[ RSS](/packages/motaword-active-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (8)Dependencies (6)Versions (24)Used By (0)

[![Latest Version on Packagist](https://camo.githubusercontent.com/410359da92b10c26a8515ac525bd33e3a738518f0668e2c28d8f2e6bcbd7000f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f64656261722d61672f6c61726176656c2d70726572656e6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codebar-ag/laravel-prerender)[![Total Downloads](https://camo.githubusercontent.com/f1cf09b59cb8e21c21423dcac30f9c1588e1eff49ce40a9c7dd89456390e26d8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f64656261722d61672f6c61726176656c2d70726572656e6465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/codebar-ag/laravel-prerender)[![run-tests](https://github.com/codebar-ag/laravel-prerender/actions/workflows/run-tests.yml/badge.svg)](https://github.com/codebar-ag/laravel-prerender/actions/workflows/run-tests.yml)[![Check & fix styling](https://github.com/codebar-ag/laravel-prerender/actions/workflows/php-cs-fixer.yml/badge.svg)](https://github.com/codebar-ag/laravel-prerender/actions/workflows/php-cs-fixer.yml)

This package was developed to give you a quick start to integrate with the MotaWord Active service to localize your Laravel application.

🙇 Credits
---------

[](#-credits)

This package is a clone from [codebar-ag/laravel-prerender](https://github.com/codebar-ag/laravel-prerender).

💡 What is MotaWord Active?
--------------------------

[](#-what-is-motaword-active)

🛠 Requirements
--------------

[](#-requirements)

- PHP: `^7.2 to ^8.2`
- Laravel: `^6 to ^10`
- MotaWord Active access

⚙️ Installation
---------------

[](#️-installation)

You can install the package via composer:

```
composer require motaword/active
```

Then, add the following to your `.env` file:

```
MOTAWORD_ACTIVE_TOKEN=active token from your MotaWord dashboard
MOTAWORD_ACTIVE_PROJECT_ID=project ID from your MotaWord dashboard
MOTAWORD_ACTIVE_WIDGET_ID=widget ID from your MotaWord dashboard
```

That's it. Every GET-Request from a crawler will be forwarded to MotaWord's Active Serve.

✋ Disable Active Serve (SEO + CDN)
----------------------------------

[](#-disable-active-serve-seo--cdn)

You can disable Active Serve service by adding the following to your `.env` file:

```
MOTAWORD_ACTIVE_SERVE_ENABLE=false
```

This may be useful for your local development environment.

✏️ How it works
---------------

[](#️-how-it-works)

1. The middleware checks to make sure we should show a prerendered page
    1. The middleware checks if the request is from a crawler (agent string or `_escaped_fragment_`)
    2. The middleware checks to make sure we aren't requesting a resource (js, css, etc...)
    3. (optional) The middleware checks to make sure the url is in the whitelist
    4. (optional) The middleware checks to make sure the url isn't in the blacklist
2. The middleware makes a `GET` request to Active Serve for the page's HTML
3. Return the HTML to the crawler

🔧 Configuration file
--------------------

[](#-configuration-file)

You can publish the config file with:

```
php artisan vendor:publish --provider="MotaWord\Active\MotaWordActiveServiceProvider"
```

Afterwards you can customize the Whitelist/Blacklist on your own.

This is the contents of the published config file:

```
