- How do I install movemoveapp/laravel-dadata2?
- Install it with Composer by running composer require movemoveapp/laravel-dadata2 in the root of your Laravel project. On supported Laravel versions the service provider is registered automatically through package discovery. After that, publish any package assets and set your DaData credentials before making your first API call. Check the repository README for the exact post-install steps, since wrappers often ship a config file that needs publishing.
- Which Laravel versions does this package support?
- The exact supported versions are pinned in the illuminate/support constraint inside the package's composer.json, so check that file before upgrading your framework. Because it is a standard Laravel wrapper, it follows normal service provider and configuration conventions. If you are on an older or very new Laravel release, compare the constraint against your app version and test on a branch first.
- How do I configure my DaData API key?
- DaData issues an API key, and some endpoints also require a secret key, from your DaData.ru account. In a Laravel wrapper these values are normally read from environment variables through the package config file, so put them in your .env and never commit them. After changing values in production, rerun php artisan config:cache so the cached configuration picks them up.
- Can this package clean and validate Russian addresses?
- Yes, standardizing messy Russian address input is the core use case, since the package wraps DaData's address suggestion and cleaning endpoints. You send the raw user input and get back a normalized result along with metadata such as confidence and quality codes. Persist the cleaned value rather than the raw string so downstream records and reports stay consistent.
- Does it support company INN lookups and bank data suggestions?
- The DaData API covers companies by INN, OGRN, or name, banks by BIC or INN, and addresses, and the wrapper exposes these party endpoints. That lets you auto-fill a company's legal name, address, and status from a single identifier. Confirm the exact method names in the README, because wrapper APIs differ between packages.
- How do I add address suggestions to a form field?
- Expose a small endpoint in your app, such as a controller route, and point your frontend autocomplete widget at it. The controller passes the query string to the wrapper's suggestion method and returns a trimmed JSON payload. Throttle that route and limit the response size, otherwise a public form can be abused to burn through your DaData quota.
- Can I use this package outside of Laravel?
- No, this is specifically a Laravel wrapper and depends on the framework's container and configuration layer. If you need DaData from a non-Laravel PHP project, use the official DaData SDK or a framework-agnostic client instead. Inside a Laravel app you can still resolve the underlying client directly if you prefer not to use the provided facade or helpers.
- How should I test code that calls DaData?
- Because these calls hit an external HTTP service, swap the client for a mock or fake in your test suite so tests stay fast and deterministic. In Laravel you can bind a stub implementation into the container, or use Http::fake if the wrapper is built on Laravel's HTTP client. Keep at most one optional integration test that runs against the real API and skip it in CI.
- What happens if the DaData API is slow or down?
- Remote suggestion calls can time out or return errors, so wrap them in try/catch and never let a DaData failure block a user from submitting a form. Fall back to accepting the raw input and clean it asynchronously or on the next edit. Use short timeouts, log failures, and consider a simple circuit breaker so slow responses do not stall page loads.
- Is the package actively maintained, and what are the alternatives?
- Check the repository's commit history, open issues, and latest release date before adopting it, since third-party Laravel wrappers vary widely in maintenance. Alternatives include other Laravel DaData packages and calling the DaData REST API directly with Laravel's HTTP client. If you only need one or two endpoints, a thin custom client can be lower risk than an unmaintained dependency.