Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Graphql Search Bundle Laravel Package

atoolo/graphql-search-bundle

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • GraphQL-Centric Search Layer: The bundle extends Symfony’s GraphQL interface with search capabilities, aligning well with modern Laravel/PHP applications leveraging GraphQL (e.g., via webonyx/graphql-php). It abstracts search logic into reusable GraphQL directives (e.g., search, filter, facet), reducing boilerplate for complex queries.
  • Symfony Bundle Compatibility: While designed for Symfony, the bundle’s core logic (search queries, resolvers, and input types) can be adapted for Laravel via Symfony Bridge (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.
  • Domain-Specific Extensions: Features like spatial search, relative date ranges, and teaser customization suggest niche use cases (e.g., media-heavy sites, location-based apps). Assess whether these align with your product’s search requirements.

Integration Feasibility

  • GraphQL Schema Integration:
    • The bundle injects search-specific types (e.g., SearchInput, FilterInput) into the GraphQL schema. In Laravel, this requires:
      • Schema Stitching: Merge the bundle’s schema extensions with your existing GraphQL schema (e.g., using graphql-php's Schema::merge()).
      • Resolver Overrides: Customize resolvers for types like Teaser, Asset, or Resource to leverage bundle-specific logic (e.g., TeaserFeature).
    • Example: Extend Laravel’s GraphQL schema via a custom Schema class:
      use Atoolo\GraphQLSearchBundle\GraphQL\Type\SearchType;
      $schema = new Schema([
          new SearchType(), // Bundle’s search types
          // ... existing types
      ]);
      
  • Search Backend Agnosticism:
    • The bundle relies on atoolo/search-bundle (likely Elasticsearch/Algolia). Ensure your Laravel app supports these backends via:
      • Elasticsearch: elasticsearch/elasticsearch PHP client.
      • Algolia: algolia/algoliasearch-client-php.
    • Fallback: If using a different search engine (e.g., Meilisearch), abstract the backend via a search adapter pattern.

Technical Risk

  • Symfony Dependency Overhead:
    • Risk: Laravel’s ecosystem lacks native Symfony bundle support. Mitigation:
      • Use Symfony’s HttpKernel in Laravel via spatie/laravel-symfony-support.
      • Extract bundle logic into standalone PHP classes (e.g., resolvers, input types) and integrate via Laravel’s service container.
    • Example: Convert the bundle’s 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)
          );
      });
      
  • GraphQL Version Mismatch:
    • The bundle targets Symfony’s GraphQL stack (likely api-platform/graphql). Laravel’s webonyx/graphql-php may require:
      • Adapter Layer: Translate bundle types (e.g., SearchInput) to webonyx/graphql-php’s InputType.
      • Testing: Validate schema compatibility via GraphQL Playground.
  • Performance:
    • Server-side query execution (added in v1.9.0) is a plus but may require:
      • Caching: Cache resolved search results (e.g., Illuminate\Support\Facades\Cache).
      • Pagination: Ensure Laravel’s pagination (Illuminate\Pagination) aligns with the bundle’s offset/limit handling.

Key Questions

  1. Search Backend:
    • Does your Laravel app already use Elasticsearch/Algolia? If not, what’s the migration path?
  2. GraphQL Stack:
    • Are you using webonyx/graphql-php? If so, how will you bridge Symfony bundle types to Laravel’s GraphQL schema?
  3. Customization Needs:
    • Do you need to extend existing types (e.g., Teaser) or add new search-specific types?
  4. Performance:
    • What’s the expected query volume? Will server-side execution suffice, or do you need client-side optimizations?
  5. Maintenance:
    • The bundle is actively developed (last release: 2026-06-02). How will you handle future Symfony/Laravel version conflicts?

Integration Approach

Stack Fit

  • Laravel Compatibility:
    • GraphQL: The bundle’s GraphQL extensions are framework-agnostic. Integrate via:
      • Option 1: Use symfony/console and symfony/http-foundation in Laravel to run Symfony bundles in a separate process (e.g., via queues).
      • Option 2: Extract bundle logic into Laravel services (e.g., resolvers, input types) and register them with webonyx/graphql-php.
    • Search Backend:
      • Elasticsearch: Use elasticsearch/elasticsearch (Laravel package: spatie/laravel-elasticsearch).
      • Algolia: Use algolia/algoliasearch-client-php (Laravel package: laravel-algolia/algolia).
  • Symfony Bridge:
    • Leverage spatie/laravel-symfony-support to run Symfony components (e.g., HttpKernel) alongside Laravel.
    • Example: Boot the bundle’s kernel in a Laravel command:
      use Symfony\Bundle\FrameworkBundle\ConsoleApplication;
      use Atoolo\GraphQLSearchBundle\AtooloGraphQLSearchBundle;
      
      $kernel = new AppKernel([AtooloGraphQLSearchBundle::class], true);
      $application = new ConsoleApplication($kernel);
      $application->run();
      

Migration Path

  1. Phase 1: Dependency Setup

    • Install required packages:
      composer require webonyx/graphql-php symfony/console symfony/http-foundation
      composer require elasticsearch/elasticsearch  # or algolia/algoliasearch-client-php
      
    • Set up the search backend (e.g., Elasticsearch index mapping or Algolia index).
  2. Phase 2: Bundle Integration

    • Option A (Symfony Bridge):
      • Create a Laravel command to initialize the bundle’s kernel.
      • Expose search endpoints via Symfony’s router (e.g., /graphql/search).
    • Option B (Standalone):
      • Copy bundle resolvers/input types to app/GraphQL/ and register them with Laravel’s GraphQL schema.
      • Example resolver:
        use Atoolo\GraphQLSearchBundle\Resolver\SearchResolver;
        use GraphQL\Type\Definition\Type;
        
        $schema->type('search', fn() => new SearchResolver(
            new SearchService(), // Your search backend
            new GraphQLContext()
        ));
        
  3. Phase 3: Schema Extension

    • Merge the bundle’s GraphQL types into your schema:
      $schema = new Schema([
          new SearchType(), // From bundle
          new QueryType([ // Your existing queries
              new SearchField(), // Custom search field
          ]),
      ]);
      
    • Extend existing types (e.g., Teaser) to include bundle-specific fields (e.g., staticImage).
  4. Phase 4: Testing

    • Test GraphQL queries with search parameters:
      query {
        search(input: {
          query: "laravel",
          filters: { source: "articles" }
        }) {
          results {
            teaser {
              headline
              staticImage { url }
            }
          }
        }
      }
      
    • Validate performance with tools like GraphQL Playground and K6.

Compatibility

  • GraphQL:
    • The bundle uses GraphQL PHP (likely api-platform/graphql). Laravel’s webonyx/graphql-php is compatible but may require:
      • Type Mapping: Convert api-platform types to webonyx types (e.g., ObjectTypeType).
      • Directive Support: Ensure @search directives work in Laravel’s schema.
  • Symfony Components:
    • Dependencies like symfony/dependency-injection can be polyfilled in Laravel via spatie/laravel-symfony-support.
  • Search Backend:
    • Ensure your backend supports the bundle’s query syntax (e.g., Elasticsearch’s query_string, Algolia’s filters).

Sequencing

  1. Prerequisites:
    • Set up GraphQL in Laravel (webonyx/graphql-php).
    • Configure search backend (Elasticsearch/Algolia).
  2. Bundle Integration:
    • Choose integration approach (Symfony Bridge or standalone).
    • Register bundle types/resolvers in Laravel’s GraphQL schema.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
daikazu/eloquent-salesforce-objects
unseen-codes/chat
romalytar/yammi-jobs-monitoring-laravel
kisame76/filament-db-table-state
nqxcode/laravel-lucene-search
dpfx/laravel-livewire-wizards
workos/workos-php-laravel
sofa/laravel-global-scope
nawasara/auth-primitives
adhocrat-io/arkhe-main
make-dev/orca-harpoon
itsemon245/lamet
baks-dev/dashboard
amoifr/pickle-panther-bundle
make-dev/orca
dmstr/symfony-system-resources-bundle
dmstr/symfony-job-queue-bundle
dmstr/openapi-json-schema-bundle
dmstr/keycloak-security-bundle
dmstr/doctrine-audit-log-bundle