- How do I install friends-of-ddd/sequence-number-generator in a Laravel app?
- Install it with composer require friends-of-ddd/sequence-number-generator. The package is PSR-4 autoloaded and is described as having conventional Laravel service provider and config wiring, so you can resolve the generator from the container. Check the repository README for the exact provider registration and configuration keys, because those details are not included in the provided overview.
- What can I use this package for, such as invoice, order, and document numbers?
- It is intended for human-readable sequential identifiers such as invoice numbers, order references, ticket IDs, policy numbers, waybills, and contract IDs. You configure a format from segments such as prefixes, suffixes, padding, and date parts, then request the next value. The package separates formatting from persistence and locking so domain code does not contain counter-table logic.
- Does friends-of-ddd/sequence-number-generator support gap-free sequences?
- The package advertises concurrency-aware generation strategies for gap-free sequences, but the provided summary does not document a transactional guarantee. True gapless numbering requires the counter allocation and the business write to commit atomically, plus a reconciliation story for rollbacks. Verify the actual behavior and write a test before relying on it for audit or regulatory requirements.
- How does it handle concurrency and horizontal scaling with PHP-FPM and queues?
- The package is described as concurrency-aware, but the summary does not specify whether it uses row locks, SELECT FOR UPDATE, Redis INCR, or advisory locks. Those choices have materially different failure and performance profiles under parallel PHP-FPM workers and queue consumers. Test with your real database and parallel workers before committing, because a local SQLite demo will not prove MySQL behavior.
- Which Laravel and PHP versions are supported?
- The assessment notes conventional Laravel 9-era wiring, but the provided context does not include a declared version matrix or CI results. Check composer.json for PHP and illuminate/support constraints and confirm there is a tagged release rather than dev-main. With no visible CI matrix, a future Laravel upgrade could orphan the package, so pin the version you adopt.
- How do I test sequence number generation without hitting the database?
- The package is persistence-agnostic by design, so the intended seam is an interface your domain depends on, with a database adapter in production and an in-memory fake in tests. Wrap the package behind your own port so tests can return deterministic values. If the package ships only one concrete implementation, define that interface yourself and keep the vendor call behind it.
- Can I customize the format with prefixes, padding, and date segments?
- The overview says formats are built from composable segments including prefixes, suffixes, padding, and date segments. That supports outputs such as INV/2025/000123. Be aware that the core may yield an integer, leaving per-tenant formats, check digits, and reset rules as your build, so confirm what the package formats versus what you must add.
- What persistence backends does it ship with, and can I use MySQL or Redis?
- The package is described as persistence-agnostic and easy to wire into Laravel or Doctrine, but the summary does not list shipped adapters. Ask whether any adapter provides gap-free allocation within the caller transaction and how it behaves under MySQL row locking or Redis INCR. If no adapter fits, you will need to implement the storage interface yourself.
- Is friends-of-ddd/sequence-number-generator maintained and safe for production?
- The available signals are weak: zero stars, zero dependents, and a near-zero composite score, so there is no field evidence of production use. That is a provenance risk rather than proof of poor quality, but you cannot infer test coverage, release cadence, or issue responsiveness from it. Pin the version, wrap it behind your own interface, and assign an internal owner in case upstream goes dormant.
- What alternatives should I consider for sequential invoice or order numbers in Laravel?
- Alternatives include database auto-increment columns, dedicated counter tables with SELECT FOR UPDATE, Redis INCR, UUIDv7 or ULID plus a display format, and larger numbering packages. Choose based on whether you need gap-free guarantees, human readability, per-tenant scoping, and reset rules. This package is a reasonable fit only if its public contract and concurrency behavior pass your own tests.