Weave 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
Php Persistence Api

Php Persistence Api Laravel Package

sweiguny/php-persistence-api

A lightweight PHP persistence API offering a simple, consistent interface for storing, retrieving, and managing data across different backends, with framework-agnostic integration for Laravel and other PHP applications.

View on GitHub
Deep Wiki
Context7

Interface for PHP-Applications to access Object-Relational data.

Frequently asked questions about Php Persistence Api
What is sweiguny/php-persistence-api and what problem does it solve?
It is a lightweight PHP persistence API that defines a simple, consistent interface for PHP applications to access object-relational data. Instead of hard-coding your application against one ORM or database layer, you code against the package's interface and swap implementations. It is framework-agnostic, so the same code can run inside Laravel or in any other PHP application. That makes it most useful for teams that want a thin, predictable data-access layer rather than a full ORM.
How do I install sweiguny/php-persistence-api with Composer?
Install it with composer require sweiguny/php-persistence-api, which resolves the package and its dependencies into your vendor directory and wires up autoloading. If you plan to use the Laravel integration, check the package README for any service provider registration or configuration publishing step, since that depends on your Laravel version. Commit your composer.json and composer.lock so the resolved version stays reproducible across environments.
Does sweiguny/php-persistence-api work with Laravel, and how is it integrated?
The package is described as framework-agnostic with integration support for Laravel, so it does not depend on Laravel internals but can be used inside a Laravel application. In practice you would bind the persistence interface to a concrete implementation in a service provider so Laravel's container can resolve it. Confirm the exact provider, facade or config key names in the package README before wiring it in, because those details are not part of the public overview. If you prefer, you can also resolve the implementation manually without container bindings.
Which PHP and Laravel versions does sweiguny/php-persistence-api support?
The package overview provided here does not list supported PHP or Laravel versions, so treat version compatibility as something to verify rather than assume. Check the require and require-dev constraints in the package's composer.json on Packagist, plus any compatibility notes in the README. Those constraints tell you exactly what Composer will accept in your environment. If you are on an older Laravel release, test installation in a branch before merging.
How do I configure a backend or data store for this persistence API?
Configuration depends on which backend you target, since the package advertises a single interface across multiple backends. Look for adapter or configuration classes in the package documentation and register the implementation that matches your database. Keep connection credentials in environment variables or Laravel's config layer rather than committing them to source control. Then verify the wiring with a small read and write against a development database before migrating real code.
Can I use sweiguny/php-persistence-api without Laravel or any other framework?
Yes. The package is framework-agnostic, so plain PHP usage only requires Composer's autoloader and an instantiation of the implementation you want. The Laravel integration is a convenience for container resolution and configuration, not a requirement. That makes it viable for legacy applications, CLI tools and small services that do not run a full framework. Just manage configuration and object lifetimes yourself in that setup.
How does sweiguny/php-persistence-api compare to Eloquent or Doctrine?
Eloquent and Doctrine are complete ORMs with query builders, migrations, relationship mapping and unit-of-work semantics. This package is better described as an abstraction layer over persistence, aiming for a small, consistent interface across backends. It fits well when you want to decouple application code from a specific ORM or support more than one data store. It is a weaker choice if you need rich ORM features such as eager-loaded relationships or automatic schema diffing out of the box.
How do I write tests for code that depends on sweiguny/php-persistence-api?
Because your code depends on an interface rather than a concrete ORM, you can substitute a fake or in-memory implementation in unit tests and assert on the calls made. Check whether the package ships its own test doubles or in-memory adapter; if not, implementing the interface yourself is usually straightforward. For integration tests, point the package at a disposable SQLite file or a dedicated test database and reset it between runs. Keep interface-level tests separate from backend-specific tests so failures point at the right layer.
Is sweiguny/php-persistence-api production-ready and actively maintained?
The overview available here does not include release history, download counts, maintainer activity or even a published repository location, so those signals need to be checked directly. Look at Packagist for the latest release date and dependency constraints, and at the source repository for open issues and recent commits. Pin an exact version in composer.json and review the code paths that handle writes and transactions before relying on it in production. If activity looks stale, plan a fallback implementation behind the same interface.
What are common pitfalls or alternatives to this persistence API?
Alternatives include Eloquent's query builder and database layer, Doctrine DBAL or ORM, and a thin PDO wrapper of your own. Common friction points with any persistence abstraction are missing backend-specific features, loosely typed result sets, and unclear transaction and error-handling semantics, so verify how the package handles each before migrating significant code. If your application is Laravel-only and small, native Eloquent may require less glue code. If portability across backends is the priority, the abstraction this package provides is the main reason to adopt it.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console