Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lumen support #156

Merged
merged 3 commits into from
Feb 27, 2019
Merged

Lumen support #156

merged 3 commits into from
Feb 27, 2019

Conversation

andriibrazhnyk
Copy link
Contributor

Hi

PR adds support of Lumen #56.

  1. It replaces helpers that are incompatible with Lumen. Lumen supports limited list of Illuminate\Foundation\helpers.
  2. Helper class SearchableFinder uses \Illuminate\Foundation\Application as DI now. Lumen uses own extension of Container - Laravel\Lumen\Application. So I added Illuminate\Container\Container class as DI (not sure about it).

In spite of the fixes extra Lumen specific setup steps are still required. Maybe it is worth to add these steps to the documentation. Something like that:

Enable Eloquent and Facades if you plan to use it:

// bootstrap/app.php:
$app->withFacades();
$app->withEloquent();

Bind path to the configuration directory with the IOC container:

// bootstrap/app.php
$app->instance('path.config', base_path('config'));

Manually copy configuration file from vendor/laravel/scout/config/scout.php to config/scout.php.

Load configuration file into the application:

// bootstrap/app.php
$app->configure('scout');

Register service provider:

// bootstrap/app.php:
$app->register(Algolia\ScoutExtended\ScoutExtendedServiceProvider::class);

@nunomaduro
Copy link
Contributor

@AndreyBrazhnyk Thank you so much for this! Can you run phpstan locally to understand why tests are failing?

@@ -32,18 +32,17 @@ final class SearchableFinder
private static $declaredClasses;

/**
* @var \Illuminate\Foundation\Application
* @var \Illuminate\Container\Container
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe here should be \Illuminate\Foundation\Application|\Laravel\Lumen\Application.

* @return void
*/
public function __construct(Application $app)
public function __construct(Container $app)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove the type hint here.

*/
private $app;

/**
* SearchableModelsFinder constructor.
*
* @param \Illuminate\Foundation\Application $app
*
* @param \Illuminate\Container\Container $app
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe here should be \Illuminate\Foundation\Application|\Laravel\Lumen\Application.

@andriibrazhnyk
Copy link
Contributor Author

Hi, Nuno

Certainly. I'll try to fix.

@nunomaduro nunomaduro merged commit 1d2acda into algolia:master Feb 27, 2019
@nunomaduro
Copy link
Contributor

Perfect. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants