atoolo/graphql-search-bundle
webonyx/graphql-php). It abstracts search logic into reusable GraphQL directives (e.g., search, filter, facet), reducing boilerplate for complex queries.symfony/http-foundation, symfony/console) or Lumen/Symfony integration (e.g., laravel/symfony-bridge). Key dependencies like atoolo/search-bundle (Elasticsearch/Algolia integration) are agnostic to the framework.SearchInput, FilterInput) into the GraphQL schema. In Laravel, this requires:
graphql-php's Schema::merge()).Teaser, Asset, or Resource to leverage bundle-specific logic (e.g., TeaserFeature).Schema class:
use Atoolo\GraphQLSearchBundle\GraphQL\Type\SearchType;
$schema = new Schema([
new SearchType(), // Bundle’s search types
// ... existing types
]);
atoolo/search-bundle (likely Elasticsearch/Algolia). Ensure your Laravel app supports these backends via:
elasticsearch/elasticsearch PHP client.algolia/algoliasearch-client-php.HttpKernel in Laravel via spatie/laravel-symfony-support.SearchResolver to a Laravel service:
$app->bind(SearchResolver::class, function ($app) {
return new SearchResolver(
$app->make(SearchService::class), // Your search backend
$app->make(GraphQLContext::class)
);
});
api-platform/graphql). Laravel’s webonyx/graphql-php may require:
SearchInput) to webonyx/graphql-php’s InputType.Illuminate\Support\Facades\Cache).Illuminate\Pagination) aligns with the bundle’s offset/limit handling.webonyx/graphql-php? If so, how will you bridge Symfony bundle types to Laravel’s GraphQL schema?Teaser) or add new search-specific types?symfony/console and symfony/http-foundation in Laravel to run Symfony bundles in a separate process (e.g., via queues).webonyx/graphql-php.elasticsearch/elasticsearch (Laravel package: spatie/laravel-elasticsearch).algolia/algoliasearch-client-php (Laravel package: laravel-algolia/algolia).spatie/laravel-symfony-support to run Symfony components (e.g., HttpKernel) alongside Laravel.use Symfony\Bundle\FrameworkBundle\ConsoleApplication;
use Atoolo\GraphQLSearchBundle\AtooloGraphQLSearchBundle;
$kernel = new AppKernel([AtooloGraphQLSearchBundle::class], true);
$application = new ConsoleApplication($kernel);
$application->run();
Phase 1: Dependency Setup
composer require webonyx/graphql-php symfony/console symfony/http-foundation
composer require elasticsearch/elasticsearch # or algolia/algoliasearch-client-php
Phase 2: Bundle Integration
/graphql/search).app/GraphQL/ and register them with Laravel’s GraphQL schema.use Atoolo\GraphQLSearchBundle\Resolver\SearchResolver;
use GraphQL\Type\Definition\Type;
$schema->type('search', fn() => new SearchResolver(
new SearchService(), // Your search backend
new GraphQLContext()
));
Phase 3: Schema Extension
$schema = new Schema([
new SearchType(), // From bundle
new QueryType([ // Your existing queries
new SearchField(), // Custom search field
]),
]);
Teaser) to include bundle-specific fields (e.g., staticImage).Phase 4: Testing
query {
search(input: {
query: "laravel",
filters: { source: "articles" }
}) {
results {
teaser {
headline
staticImage { url }
}
}
}
}
api-platform/graphql). Laravel’s webonyx/graphql-php is compatible but may require:
api-platform types to webonyx types (e.g., ObjectType → Type).@search directives work in Laravel’s schema.symfony/dependency-injection can be polyfilled in Laravel via spatie/laravel-symfony-support.query_string, Algolia’s filters).webonyx/graphql-php).How can I help you explore Laravel packages today?