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

Laravel Dadata Laravel Package

jiexaspb/laravel-dadata

Laravel SDK для работы с API DaData.ru: подсказки и стандартизация адресов и данных. Поддержка PHP 7.3–8.1, Laravel 7–9, настройка через .env (token/secret/timeout), публикация конфигурации и удобная интеграция через сервис-провайдер.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Purpose Alignment: The package is a specialized SDK for integrating with DaData.ru’s API (address validation, contact data correction, and form hint suggestions). This aligns well with customer data quality (CDQ) use cases in e-commerce, SaaS, or CRM systems where manual data entry errors (e.g., misspelled addresses, invalid phone numbers) are costly.
  • Laravel-Native Design: Leverages Laravel’s service provider pattern, config-based API keys, and facade/manager patterns, making it low-friction for Laravel apps. The package abstracts HTTP calls (via Guzzle) and response parsing, reducing boilerplate.
  • Domain-Specific Value: Provides pre-built validation logic (e.g., suggest() for addresses, clean() for phone numbers) rather than raw API wrappers, which accelerates implementation of data enrichment workflows.

Integration Feasibility

  • Minimal Setup: Requires only:
    • Composer install (movemoveapp/laravel-dadata).
    • API key configuration in .env (e.g., DADATA_API_KEY).
    • Optional: Service provider registration (auto-discovered in Laravel ≥5.5).
  • Guzzle Dependency: Uses Guzzle 7.x, which is LTS-compatible with Laravel’s default HTTP client (though the package doesn’t override Laravel’s HTTP client, which could be a pro/con depending on isolation needs).
  • Response Handling: Returns structured PHP objects/arrays (e.g., DaDataResponse), easing integration with Laravel’s Form Requests, Validation, or Model observers.

Technical Risk

  • Low-Medium Risk:
    • API Dependency: DaData’s API is third-party; downtime or rate limits could disrupt workflows. Mitigation: Implement retry logic (e.g., Laravel’s retry helper) or fallback caching for non-critical suggestions.
    • Version Lock: Package supports PHP 7.3–8.1 and Laravel 7–9, but no Laravel 10+ support (released post-2023-04-20). Risk: Future Laravel upgrades may require manual patches.
    • Limited Testing: 0 stars, no active maintenance (last release 2023-04-20). Risk: Undiscovered bugs in edge cases (e.g., non-RU addresses). Mitigation: Unit test critical paths (e.g., DaData::suggest() with mock responses).
  • High Risk:
    • No Type Safety: Uses dynamic method calls (e.g., DaData::clean($data)) without strict return types. Risk: Runtime errors if API responses change. Mitigation: Add PHPDoc return types or use return_type in Laravel 8+.
    • No Async Support: Synchronous calls only. Risk: Blocking UI in real-time validation. Mitigation: Queue delayed jobs for non-critical validations (e.g., suggest() after form submission).

Key Questions

  1. Use Case Criticality:
    • Is DaData’s validation blocking (e.g., real-time form feedback) or asynchronous (e.g., batch cleanup)?
    • What’s the cost of API errors (e.g., failed suggestions vs. manual review)?
  2. Data Scope:
    • Will you use all DaData endpoints (e.g., clean, suggest, findById) or just a subset?
    • Are there custom response transformations needed (e.g., mapping DaData’s result.value to your model fields)?
  3. Performance:
    • What’s the expected call volume? DaData has rate limits (e.g., 1000 requests/minute for paid plans).
    • Will you cache responses (e.g., Redis) for repeated queries (e.g., same address)?
  4. Maintenance:
    • Who will monitor API health (e.g., 429 errors, latency)?
    • Is there a backup plan for API failures (e.g., graceful degradation)?
  5. Compliance:
    • Does DaData’s data processing comply with GDPR/CCPA if handling PII (e.g., addresses)?
    • Are there audit logs needed for DaData API calls?

Integration Approach

Stack Fit

  • Laravel Ecosystem:
    • Form Validation: Integrate with Laravel’s Form Requests or Validation rules (e.g., custom dadata_valid rule).
      use MoveMoveIo\DaData\Facades\DaData;
      $validated = DaData::clean($request->address);
      
    • Model Observers: Auto-clean data on saving/updating:
      public function saving(User $user) {
          $user->address = DaData::clean($user->address);
      }
      
    • Livewire/Inertia: Use for real-time suggestions in frontend forms (via API calls).
  • Non-Laravel Components:
    • Queue Workers: Offload non-critical validations to Laravel Queues (e.g., DaDataJob).
    • API Gateway: If using Lumen or API resources, wrap DaData calls in a dedicated service layer.

Migration Path

  1. Phase 1: Proof of Concept (1–2 days)
    • Install package and test basic endpoints (e.g., DaData::suggest('ул. Ленина')).
    • Verify response format matches your data model (e.g., result.valueaddress field).
    • Mock API failures to test fallback behavior.
  2. Phase 2: Core Integration (3–5 days)
    • Integrate with form handling (e.g., Livewire/Inertia for frontend, Form Requests for backend).
    • Add validation rules (e.g., Rule::custom('dadata_valid')).
    • Implement observers for model-level cleaning.
  3. Phase 3: Optimization (1–2 weeks)
    • Add rate limiting (e.g., throttle middleware for API routes).
    • Implement caching (e.g., Redis for frequent queries).
    • Set up monitoring (e.g., Laravel Horizon for queue jobs, Sentry for errors).

Compatibility

  • Laravel Versions: Supports 7.x–9.x; Laravel 10+ may need adjustments (e.g., PHP 8.2+ compatibility).
  • PHP Extensions: No special requirements beyond Guzzle (included via Composer).
  • Database: No direct DB dependencies, but model observers require Eloquent.
  • Frontend: Works with any frontend (React, Vue, etc.) via API endpoints or Livewire.

Sequencing

Step Task Dependencies Owner
1 Install package + config API key Composer, .env DevOps/Backend
2 Test basic endpoints (e.g., suggest, clean) DaData API access QA/Backend
3 Integrate with form validation Laravel Validation Frontend/Backend
4 Add model observers for auto-cleaning Eloquent models Backend
5 Implement caching (Redis) for frequent queries Redis setup DevOps
6 Set up error monitoring (Sentry) Sentry config DevOps
7 Optimize rate limiting (e.g., queue delays) Laravel Queues Backend

Operational Impact

Maintenance

  • Pros:
    • Low Maintenance: Package handles API auth, request/response parsing, and error formats.
    • Config-Driven: API key and endpoints are centralized in .env.
  • Cons:
    • No Active Maintenance: Risk of breaking changes if DaData’s API evolves. Mitigation: Fork the repo or wrap calls in a service layer to isolate changes.
    • Undocumented Edge Cases: Lack of community support may require reverse-engineering API docs.
  • Ongoing Tasks:
    • API Key Rotation: Update .env periodically.
    • Dependency Updates: Monitor for Guzzle/Laravel version conflicts.
    • DaData API Changes: Test new endpoints or response formats if DaData updates.

Support

  • Internal:
    • Documentation: Create internal runbooks for:
      • Common errors (e.g., 401 Unauthorized, 429 Rate Limit).
      • Response formats (e.g., suggest() vs. clean()).
    • Debugging: Log raw DaData responses for troubleshooting.
  • External:
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.
emuniq/filament-browser-notifications
syriable/filament-translator
hungnm28/livewire-form
wenprise/eloquent
crudly/encrypted
fadion/bouncy
cuci/prototurk-sdk
gos/pubsub-router-bundle
cuci/prototurk-sdk-symfony
clementtalleu/easyadmin-markdown-bundle
codeflextech/permission-manager
karnoweb/livewire-datepicker
sayedenam/sayed-dashboard
milito/query-filter
apiboxsym/user-bundle
apiboxsym/health-check-bundle
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui