- Is conserto/pomm-model-manager suitable for Laravel apps needing PostgreSQL model layers without an ORM?
- Yes, this package provides a lightweight model layer for PostgreSQL in Laravel, offering CRUD, count/exists, and transactional operations while leveraging Postgres’ native features. It’s ideal for performance-critical apps where you want to avoid ORM overhead. However, it requires manual integration with Laravel’s ecosystem.
- How do I install Pomm ModelManager in a Laravel project?
- Add `conserto/pomm-model-manager` to your `composer.json` under `require`, then configure Pomm’s `SessionBuilder` in your Pomm instance. The package also recommends installing the `conserto/pomm-cli` for better workflows. No Laravel-specific setup is required beyond basic Pomm configuration.
- Does Pomm ModelManager support Laravel’s Eloquent relationships or Scout caching?
- No, this package is not designed for Eloquent integration. Relationships must be manually managed via accessors or custom logic, and there’s no built-in support for Laravel Scout or other caching layers. It’s a PostgreSQL-native solution, not an ORM.
- What Laravel and PHP versions does conserto/pomm-model-manager support?
- The package itself is PHP 8.1–8.5 compatible (as of v4.0.8) and has no Laravel-specific dependencies. Ensure your Laravel version supports PHP 8.5 if you plan to use its latest features. For Laravel 10+, PHP 8.5 is recommended for long-term compatibility.
- Can I use Pomm ModelManager for complex transactions with PostgreSQL-specific settings like constraint deferral?
- Yes, the package includes advanced transaction controls, such as constraint deferral, isolation levels, and read/write modes. This is useful for PostgreSQL-specific workflows where you need fine-grained transaction management beyond what Laravel’s database layer offers.
- How does Pomm ModelManager handle embedded entities or nested data structures?
- The package includes an embedded entities converter, allowing you to work with nested data structures directly in your models. This is particularly useful for PostgreSQL’s JSON/JSONB types or composite types, though you’ll need to define how these are serialized/deserialized in your model classes.
- Are there performance benefits over Laravel’s built-in Eloquent ORM for PostgreSQL?
- Yes, since Pomm ModelManager avoids ORM abstractions, it can offer better performance for PostgreSQL-specific queries, especially when using native types or complex transactions. However, benchmarks depend on your use case—test with your actual workloads.
- How do I test Pomm ModelManager in a Laravel project?
- Use Atoum (the package’s test framework) or integrate it with Laravel’s PHPUnit. The `ModelSessionAtoum` class simplifies session setup in tests. For Laravel-specific testing, mock Pomm’s session builder or use dependency injection to swap out the database layer during tests.
- What are the alternatives to Pomm ModelManager for PostgreSQL in Laravel?
- Alternatives include Eloquent (Laravel’s built-in ORM), Doctrine ORM, or raw PDO/QueryBuilder. If you need PostgreSQL-specific features without ORM overhead, Pomm is a strong choice. For simpler apps, Eloquent may suffice, but it lacks PostgreSQL-native optimizations.
- Does Pomm ModelManager support PHP 8.5’s new features like enums or readonly properties?
- Yes, the package is PHP 8.5 compatible and can leverage enums or readonly properties in model classes. For example, you can use enums for model states or readonly properties for immutable fields. This aligns with Laravel’s future PHP requirements and reduces migration friction.