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
Statamic Algolia Places

Statamic Algolia Places Laravel Package

spatie/statamic-algolia-places

Add an Algolia Places-powered location fieldtype to Statamic 3. Provides address autocomplete in the control panel and stores structured location data (city, country, lat/lng, postcode, etc.). Supports all Algolia Places configuration options.

View on GitHub
Deep Wiki
Context7

An Algolia Places autocomplete dropdown fieldtype for the Statamic Control Panel

Frequently asked questions about Statamic Algolia Places
Does this package work with Statamic 4.x, or is it limited to Statamic 3.x?
This package is explicitly designed for **Statamic 3.x** and has not been updated for Statamic 4.x. The last release was in 2021, so compatibility with Statamic 4.x is untested. If you’re using Statamic 4.x, consider alternatives like custom fieldtypes built on Algolia’s Places API or waiting for an official update.
How do I install and configure the Algolia Places fieldtype in Statamic?
Install via Composer with `composer require spatie/statamic-algolia-places`, then add the fieldtype to your Blueprint’s `fields.yaml` using `type: spatie/algolia-places`. Configure your Algolia Places API key in `.env` under `ALGOLIA_PLACES_API_KEY`. No additional runtime setup is required—the fieldtype auto-loads in the Statamic Control Panel.
What happens if the Algolia API is unavailable or returns errors?
The package does not include built-in fallback mechanisms for API failures. If Algolia’s API is down, the autocomplete dropdown will fail silently. To mitigate this, you could extend the fieldtype to show a static dropdown or error message, or implement client-side caching for offline use.
Can I customize the output fields or templates for Algolia Places?
The package outputs a fixed YAML structure (e.g., `name`, `administrative`, `latlng`). To customize fields or templates, you’ll need to extend the fieldtype class or override Twig templates. Check the [Algolia Places documentation](https://community.algolia.com/places/) for available options and modify the fieldtype’s `config.php` accordingly.
Is this package compatible with multi-language Statamic setups?
The package itself does not handle localization, but Algolia Places supports multi-language queries. Location names (e.g., `city`, `country`) are returned as-is. For true multi-language support, you’d need to manually translate the returned fields in your Statamic templates or use Statamic’s built-in localization features to store translated versions.
What are the performance implications of using Algolia Places in the Statamic CP?
Algolia Places API calls introduce latency during content entry, especially for slow connections. The package does not cache responses by default, so repeated searches may hit Algolia’s rate limits. For better performance, consider caching responses in Statamic’s session or implementing client-side caching (e.g., via JavaScript).
Are there unit tests or integration tests for this package?
The package’s repository does not include visible unit or integration tests in the public codebase. Without tests, edge cases like invalid API keys or malformed responses may go unhandled. If reliability is critical, test thoroughly in a staging environment or extend the fieldtype to add validation logic.
What alternatives exist for Algolia Places in Statamic if I want to avoid vendor lock-in?
Alternatives include using Statamic’s native `address` fieldtype with custom validation, integrating Google Maps Places API via a custom fieldtype, or leveraging Laravel’s built-in geocoding services (e.g., `geocoder-php`). For a more open-source approach, consider self-hosted solutions like [Photon](https://github.com/franzheidl/photon) or [Nominatim](https://nominatim.org/).
How do I handle Algolia’s API key securely in production?
Store your Algolia Places API key in Statamic’s `.env` file under `ALGOLIA_PLACES_API_KEY`. Never hardcode keys in Blueprints or templates. Use Statamic’s environment variables to manage secrets, and restrict API key permissions in Algolia’s dashboard to only the required endpoints (e.g., Places search).
Can I use this package with other Statamic addons or custom fieldtypes?
Yes, the package follows Statamic’s fieldtype conventions and should integrate smoothly with other addons. However, avoid conflicts by ensuring no other package overrides the same fieldtype namespace (`spatie/algolia-places`). For custom extensions (e.g., adding validation), subclass the fieldtype and override methods like `toArray()` or `expand()`.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport