<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
miroshnichenko-yaroslav / laravel-algolia example snippets
// Search.
$algolia->search('marty mcfly');
// Create global API keys.
$algolia->addUserKey(['search'], 300);
// Want to use the facade?
Algolia::getLogs();
// You can alias this in config/app.php.
use Vinkla\Algolia\Facades\Algolia;
Algolia::initIndex('contacts');
// We're done here - how easy was that, it just works!
Algolia::getLogs();
// This example is simple and there are far more methods available.
use Vinkla\Algolia\Facades\Algolia;
// Writing this…
Algolia::connection('main')->initIndex('contacts');
// …is identical to writing this
Algolia::initIndex('contacts');
// and is also identical to writing this.
Algolia::connection()->initIndex('contacts');
// This is because the main connection is configured to be the default.
Algolia::getDefaultConnection(); // This will return main.
// We can change the default connection.
Algolia::setDefaultConnection('alternative'); // The default is now alternative.
use Vinkla\Algolia\AlgoliaManager;
class Foo
{
protected $algolia;
public function __construct(AlgoliaManager $algolia)
{
$this->algolia = $algolia;
}
public function bar()
{
$this->algolia->initIndex('friends');
}
}
App::make('Foo')->bar();
bash
$ php artisan vendor:publish
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.