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

Glob Finder Laravel Package

dantleech/glob-finder

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Hierarchical Data Model Alignment: The package is optimized for PHPCR/ODM, a document-centric hierarchical storage system (e.g., CMS, DAM). If the Laravel app uses Doctrine PHPCRBundle (e.g., for eZ Platform, Sulu, or custom PHPCR-backed systems), this package provides a clean abstraction for glob-based path queries. For non-PHPCR systems (e.g., traditional SQL databases or Laravel’s filesystem), the fit is poor without significant adaptation.
  • Laravel Ecosystem Gap: Laravel lacks native PHPCR support, so integration requires additional bundles (doctrine/phpcr-bundle, dantleech/phpcr-odm). The package assumes PHP 5.6+ and Doctrine PHPCR ODM ~1.2, which may conflict with modern Laravel (PHP 8.x) or newer PHPCR versions.
  • Query Simplification: Replaces manual path concatenation or SQL LIKE queries with a declarative glob syntax (e.g., /cmf/articles/*), reducing boilerplate for hierarchical traversal.

Integration Feasibility

  • PHPCR Dependency: The package is hardcoded to PHPCR/ODM with no extensibility for other backends. To use it in Laravel:
    • Option 1: Adopt PHPCR/ODM (requires doctrine/phpcr-bundle + dantleech/phpcr-odm).
    • Option 2: Build a wrapper layer to translate globs to Laravel’s filesystem (e.g., Storage::glob()) or SQL queries, but this risks performance penalties and inconsistent behavior.
  • Laravel Compatibility Risks:
    • No Laravel-specific features: The package lacks service container integration, caching, or Laravel event hooks.
    • PHP Version Mismatch: The package uses pre-PHP 7.4 syntax (e.g., no typed properties, no nullsafe operator), which may require polyfills or forks for modern Laravel.
  • Alternatives in Laravel:
    • Filesystem: Use Illuminate\Support\Facades\Storage::glob() (non-recursive) or league/flysystem-glob for recursive patterns.
    • SQL: Replace globs with LIKE or full-text search (e.g., WHERE path LIKE '/path/%').
    • Elasticsearch: For large-scale hierarchical search, consider scout or laravel-elasticsearch.

Technical Risk

  • Abandoned Package: Last commit in 2016; no active maintenance. Risks include:
    • Bugs in PHPCR v2+: The package may not work with newer Doctrine PHPCR versions.
    • Security Vulnerabilities: Dependencies (e.g., jackalope/jackalope-fs) may have unpatched CVEs.
  • Performance:
    • PHPCR: Glob traversal can be slow for deep hierarchies without indexing. Benchmark against native PHPCR queries (e.g., find() with path constraints).
    • Filesystem: Recursive globs may hit memory limits or I/O bottlenecks for large directories.
  • Vendor Lock-in: Tight coupling to PHPCR/ODM makes it difficult to migrate to other backends (e.g., Elasticsearch, MongoDB).

Key Questions

  1. Backend Dependency:
    • Is PHPCR/ODM a hard requirement, or could globs be implemented via Laravel’s filesystem/SQL?
    • If PHPCR is used, what version? Are there conflicts with doctrine/phpcr-bundle?
  2. Use Case Criticality:
    • Are globs used for core functionality (e.g., CMS content retrieval) or non-critical tasks (e.g., migration scripts)?
    • What’s the failure impact if the package breaks (e.g., no fallback mechanism)?
  3. Maintenance Plan:
    • Who will support/debug the package if issues arise (e.g., PHPCR version conflicts)?
    • Is there a forking strategy to modernize the package (e.g., PHP 8.x support)?
  4. Performance Requirements:
    • What’s the expected scale (e.g., depth/breadth of hierarchies)?
    • Are there alternatives (e.g., indexed PHPCR queries, Elasticsearch) that could replace globs?
  5. Laravel Integration:
    • How will the package be bound to Laravel’s service container?
    • Are there custom extensions needed (e.g., caching, event hooks)?

Integration Approach

Stack Fit

Component Fit Alternatives
PHPCR/ODM Direct Fit: Package is designed for PHPCR. None (if PHPCR is required).
Laravel Filesystem Poor Fit: No native recursive glob support. league/flysystem-glob, custom recursion with Storage::allFiles().
SQL Databases Indirect Fit: Glob patterns require translation to LIKE or custom queries. Laravel query builder, spatie/laravel-query-builder.
Elasticsearch No Fit: Package doesn’t support Elasticsearch. Custom mapping of globs to Elasticsearch queries.
CMS Integrations Good Fit: e.g., eZ Platform, Sulu (if PHPCR-backed). Native CMS APIs (e.g., eZ’s ContentService).

Migration Path

  1. Assess Backend Compatibility:
    • If using PHPCR/ODM:
      • Install dependencies:
        composer require doctrine/phpcr-bundle dantleech/phpcr-odm dantleech/glob-finder
        
      • Configure doctrine/phpcr-bundle in config/packages/doctrine_phpcr.yaml.
    • If using Laravel Filesystem:
      • Option A: Replace with league/flysystem-glob for recursive globs.
      • Option B: Build a custom service:
        class LaravelGlobFinder {
            public function find(string $pattern): array {
                return collect(Storage::disk('local')->allFiles())->filter(
                    fn ($path) => fnmatch($pattern, $path)
                )->values()->all();
            }
        }
        
  2. Query Translation Layer:
    • Create a facade or service to abstract glob logic:
      class GlobFinderFacade {
          public function find(string $pattern): array {
              if (app()->bound('phpcr.odm.document_manager')) {
                  return (new PhpcrOdmTraversalFinder(app('phpcr.odm.document_manager')))->find($pattern);
              }
              // Fallback to filesystem/SQL
              return $this->fallbackFind($pattern);
          }
      }
      
  3. Sequential Rollout:
    • Phase 1: Implement globs for one critical use case (e.g., article retrieval).
    • Phase 2: Replace all manual path queries with the package (or alternative).
    • Phase 3: Add caching (e.g., Illuminate\Support\Facades\Cache) for frequent globs.

Compatibility

  • PHPCR Versions:
    • The package targets Doctrine PHPCR ODM ~1.2. Test with:
      • doctrine/phpcr-bundle:^1.0 (for PHPCR 2.x).
      • dantleech/phpcr-odm:^1.2.
    • Risk: Conflicts may arise with newer PHPCR bundles (e.g., phpcr vs. doctrine/phpcr).
  • Laravel Versions:
    • PHP 8.x: The package may fail due to pre-PHP 7.4 syntax. Solutions:
      • Use a polyfill (e.g., nikic/php-parser to rewrite code).
      • Fork and modernize the package (e.g., add typed properties).
    • Dependency Conflicts:
      • jackalope/jackalope-fs (dev dependency) may conflict with other Jackalope implementations.
      • Test with composer why-not dantleech/glob-finder for conflicts.

Sequencing

  1. Pre-Integration:
    • Benchmark: Compare glob performance against native alternatives (e.g., PHPCR find(), SQL LIKE).
    • Prototype: Implement a single glob query and validate results.
  2. Integration:
    • PHPCR Path: Bind the package to Laravel’s container and test in a staging environment.
    • Fallback Path: Implement a filesystem/SQL fallback for non-PHPCR setups.
  3. Post-Integration:
    • Monitor: Track glob query performance and failures (e.g., invalid paths).
    • Document: Record edge cases (e.g., recursive globs, special characters) and work
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.
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor