2017 © Pedro Peláez
 

library laravel-scout-settings

Import/Export Algolia settings into your Laravel Scout project

image

ubeeqo/laravel-scout-settings

Import/Export Algolia settings into your Laravel Scout project

  • Tuesday, May 29, 2018
  • by aspitzer
  • Repository
  • 1 Watchers
  • 0 Stars
  • 19 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 10 Forks
  • 0 Open issues
  • 8 Versions
  • 36 % Grown

The README.md

Laravel Scout Settings

Import/Export Algolia settings, synonyms and query rules into your Laravel Scout project., (*1)

The easiest way to manage your settings is usually to go to your Algolia dashboard because it has a nice UI and you can test the relevancy directly there., (*2)

Once you fine tuned your configuration, you may want to add it to your project., (*3)

This package adds two Laravel commands to your project:, (*4)

  • one to save your settings, synonyms and query rules into JSON files
  • one to push everything back to Algolia

This has 3 major advantages:, (*5)

  1. You can version your configuration with your VCS
  2. You can set up a new environment or restore backups easily
  3. It lets you customize your settings in JSON format before pushing them

Install

Install this package with composer, (*6)

composer require algolia/laravel-scout-settings

Laravel 5.5

If you use Laravel 5.5, this package will take advantage of the Package Auto-Discovery feature. Nothing more to do to register the commands., (*7)

Laravel 5.4 and prior

If you use an older version of Laravel, you will have to add the Service Provider to the providers array in config/app.php, (*8)

Algolia\Settings\ServiceProvider::class,

Usage

You will now get two new commands available in artisan. They both take a model's fully qualified class name, just like Laravel Scout does to import/flush data., (*9)

The following example assume you have an App\Contact class, which uses the Searchable trait., (*10)

Note: Scout allows you to customize the index name with the searchableAs() method. This package will follow this naming convention., (*11)

Backing up settings (Project ⬅️ Algolia)

The following command will export all the settings and synonyms from the App\Contact's index into the following files:, (*12)

  • Settings: resources/algolia-settings/index_name.json
  • Synonyms: resources/algolia-settings/index_name-synonyms.json
  • Query Rules: resources/algolia-settings/index_name-rules
php artisan algolia:settings:backup "App\Contact"

Note that if you want to add the prefix to your file names (which was the default behavior in v1), you can pass the --prefix option., (*13)

php artisan algolia:settings:backup "App\Contact" --prefix

Pushing settings (Project ➡️ Algolia)

The following command will read all the settings, synonyms and query rules from the files in resources/algolia-settings/ and import them into Algolia's index., (*14)

php artisan algolia:settings:push "App\Contact"

You can also pass the --prefix option, just like the backup command., (*15)

Customizing directory

By default, settings, rules and synonyms are saved into the resources/algolia-settings. The directory can be customized by the defining an environment variable named ALGOLIA_SETTINGS_FOLDER. For example, the following command will save all the index resources into resources/indexmeta., (*16)

ALGOLIA_SETTINGS_FOLDER=indexmeta php artisan algolia:settings:backup

Testing

bash composer test, (*17)

Need help?

Feel free to open a thread on our Community forum, (*18)

Contribute

Contributions are welcome!, (*19)

The Versions

29/05 2018

dev-master

9999999-dev

Import/Export Algolia settings into your Laravel Scout project

  Sources   Download

MIT

The Requires

 

The Development Requires

by Julien Bourdeau

laravel search algolia

29/05 2018

2.0.1

2.0.1.0

Import/Export Algolia settings into your Laravel Scout project

  Sources   Download

MIT

The Requires

 

The Development Requires

by Julien Bourdeau

laravel search algolia

27/03 2018

dev-fix/prefix-for-replica

dev-fix/prefix-for-replica

Import/Export Algolia settings into your Laravel Scout project

  Sources   Download

MIT

The Requires

 

The Development Requires

by Julien Bourdeau

laravel search algolia

21/03 2018

2.0.0

2.0.0.0

Import/Export Algolia settings into your Laravel Scout project

  Sources   Download

MIT

The Requires

 

The Development Requires

by Julien Bourdeau

laravel search algolia

27/02 2018

1.0.1

1.0.1.0

Import/Export Algolia settings into your Laravel Scout project

  Sources   Download

MIT

The Requires

 

by Julien Bourdeau

laravel search algolia

19/10 2017

1.0.0

1.0.0.0

Import/Export Algolia settings into your Laravel Scout project

  Sources   Download

MIT

The Requires

 

by Julien Bourdeau

laravel search algolia

27/07 2017

0.2.0

0.2.0.0

Import/Export Algolia settings into your Laravel Scout project

  Sources   Download

MIT

The Requires

 

by Julien Bourdeau

laravel search algolia

06/07 2017

0.1.0

0.1.0.0

Import/Export Algolia settings into your Laravel Scout project

  Sources   Download

MIT

The Requires

 

by Julien Bourdeau

laravel search algolia