jolicode/elastically
jolicode/elastically is an elegant Elasticsearch client for PHP. It simplifies index management, document indexing, and query building with a fluent API, making search integration cleaner and more maintainable in Symfony and other PHP applications.
What the package is. jolicode/elastically is a thin, opinionated bootstrap layer over Elastica, the long-standing PHP client wrapper for Elasticsearch. Its value is not the HTTP transport (Elastica already does that) but the index-as-configuration workflow: index settings and mappings declared in YAML, a client subclass that loads them, data-provider hooks for populating indices, and a console command set for creating, populating, and reindexing indices. It is framework-agnostic PHP with an optional Symfony bundle; it is not a Laravel package and ships no service provider, facade, or config publishing.
Architecture fit. Fit depends on which problem you are solving:
Elasticsearch\Client calls scattered through service classes.jolicode/explorer, from the same maintainer) covers model sync, observers, and query building with far less bespoke wiring. Elastically is the layer underneath that concern, not a replacement for it.The realistic posture is: Scout/Explorer for query-time and model synchronization, Elastically for index definition and reindex orchestration — or Elastically alone if the domain is not Eloquent-shaped (aggregations, multi-index search, denormalized read models).
Integration feasibility. Composer-installable, PSR-4, MIT, no framework coupling in the core. The integration work is entirely "glue you own":
Elastically\Client as a singleton, constructed from config/elasticsearch.php rather than the package's YAML-driven client factory.config/*.php. Either commit to YAML outside the config cache (and accept that mappings are not config:cache-aware) or write a small loader that composes YAML into Laravel config. The former is simpler; the latter is more idiomatic.Technical risk. Ranked:
Key questions to resolve before approval.
Stack fit. PHP 8.x, Laravel 10–12, Composer. Elastically pulls Symfony Console (already transitively present in every Laravel app) and Elastica. The dependency footprint is modest and does not collide with Laravel's own packages. The Symfony bundle is unusable here and should be excluded mentally; only the core library and console commands matter.
Migration path. Treat this as introducing a search-infrastructure component, not swapping a library:
SearchIndexManager interface in front of the Elastically client. Every call site depends on the interface, not the package. This is the single highest-leverage decision for future exit.orders_v3) and a stable alias (orders). Mappings are code-reviewed artifacts from this point forward.Compatibility. Pin explicitly in composer.json and document the supported ES major in the README. Add a CI job that runs the integration spike against a containerized ES of the target version — this is the only reliable guard against the version-matrix risk. Confirm OpenSearch is out of scope (or test it separately; Elastica's OpenSearch support is not guaranteed).
Sequencing relative to other work. Do the spike before committing to a mapping-heavy feature roadmap. If the spike reveals the package cannot express your mapping or your query patterns, the fallback is raw Elastica — a smaller delta than it sounds, because Elastically is thin. Do not sequence this in parallel with an ES server major upgrade; combine them into one migration or defer one.
Maintenance. Low ongoing code churn, but you own the Laravel glue permanently. The realistic annual cost is a few days: dependency bumps, ES version verification, and re-testing the command bridge. Vendor or fork if upstream stalls — the surface area is small enough that a fork is a weekend, not a quarter. Track upstream releases but do not assume responsive issue triage.
Support. Community-only, no SLA, no vendor escalation. Internal ownership must be explicit: name a primary and a secondary. Document the reindex runbook, the alias conventions, and the "what to do when ES returns a mapping conflict" playbook — these are the artifacts that determine whether an on-call engineer can recover at 2 a.m.
Scaling. Elastically itself does not constrain cluster scale; it is a client-side convenience layer. Scaling pressure shows up as (a) population throughput — solved with chunked queued jobs and controlled concurrency, not with the package; (b) mapping/shard design — solved by review discipline, not tooling; (c) query latency — solved at the ES cluster and query layer, largely outside this package's remit. Expect the package to be neutral on scale and the surrounding design to determine it.
Failure modes to instrument.
--limit guard.Ramp-up. A mid-level Laravel developer with no Elasticsearch background needs roughly 1–2 weeks to be productive and 4–6 weeks to be trusted with mappings. The learning burden is Elasticsearch concepts (analyzers, mappings, aliases, shard design) and Elastica's API — not the package, which is learnable in an afternoon. Budget for one person to become the internal search subject-matter expert, and front-load that investment: the failure modes above are all design failures that a knowledgeable owner prevents and a naive integrator ships.
How can I help you explore Laravel packages today?