- Does Greenter Core support all SUNAT document types (e.g., 07 for invoices, 08 for credit notes, 39 for receipts) for Peruvian electronic invoicing?
- The package provides abstractions like `BaseSale` and `DespatchDetail` tailored for SUNAT’s UBL 2.1 schema, covering core document types. However, verify the latest SUNAT regulations (e.g., e-invoicing v4.0) as the package’s last update was in 2020. Test against SUNAT’s validation tools to confirm full compliance for your specific use case.
- How do I install Greenter Core in a Laravel 10+ project with PHP 8.2+?
- Run `composer require greenter/core`. Due to deprecated Symfony Validator annotations, you’ll need to fork the package and update dependencies manually. Bind interfaces (e.g., `ErrorCodeProvider`) in your `AppServiceProvider` using Laravel’s container. Avoid conflicts by isolating validator logic or replacing it with PHP 8.2 attributes.
- Will Greenter Core work with my existing Eloquent models for invoices and tax details?
- The package assumes tables like `sales`, `sale_details`, and `despatch_details`. Align migrations by renaming fields (e.g., `Unit` → `UnitMeasure`) if conflicts exist. Use traits or decorators to bridge Greenter’s abstractions with Eloquent, but expect manual mapping for SUNAT-specific fields like `sunat_code`.
- Can I use Greenter Core without Symfony Validator due to Laravel’s built-in validation?
- Yes, replace Symfony annotations with Laravel’s validation (e.g., form requests) or PHP 8.2 attributes. Isolate validator logic in a service layer to avoid conflicts. For SUNAT-specific rules (e.g., IGV calculation), create custom validators or leverage Laravel’s `Validated` trait in controllers.
- What’s the best way to generate PDFs/XML for SUNAT documents with Greenter Core?
- Integrate with `spatie/pdf` for PDFs or Laravel Excel for XML exports. Create a `GreenterDocumentRenderer` service to handle UBL 2.1 templates. Test performance for high-volume invoicing, as XML generation can be resource-intensive. Consider caching rendered documents if SUNAT allows it.
- How do I handle schema migrations if Greenter Core’s tables conflict with my existing database?
- Audit your current schema for overlaps (e.g., `Unit` vs. `UnitMeasure`). Use Laravel migrations to rename or merge tables, or create a custom migration layer to abstract Greenter’s schema. Document changes in a `README` for future updates, as the package lacks ORM-agnostic support.
- Is Greenter Core actively maintained? What’s the upgrade path for SUNAT’s future regulations?
- The package hasn’t been updated since 2020, so plan for a fork to modernize dependencies (PHP 8.2+, Laravel 10+). For SUNAT updates (e.g., e-invoicing v4.0), extend the package’s abstractions or create a wrapper layer. Monitor SUNAT’s official documentation for breaking changes.
- Are there undocumented dependencies (e.g., file storage, queues) I should know about?
- The package relies on Symfony components (e.g., `symfony/validator`), which may introduce security risks if outdated. Review `composer.json` for hidden dependencies like file storage adapters. Test in a staging environment to identify any implicit requirements for attachments or notifications.
- How can I test SUNAT compliance after integrating Greenter Core?
- Use SUNAT’s validation tools to test generated XML/PDF documents. Write PHPUnit tests for critical logic (e.g., IGV calculations, error codes) by mocking Greenter’s interfaces. Validate against real-world scenarios, like edge cases for discounts or multi-currency sales.
- What are the alternatives to Greenter Core for SUNAT-compliant invoicing in Laravel?
- Consider `spatie/laravel-invoice` for general invoicing or `facturaelectronica/pe` for Peru-specific SUNAT integration. For full DDD alignment, build a custom package using Greenter’s abstractions as a reference. Evaluate alternatives based on active maintenance, Laravel compatibility, and SUNAT compliance.