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

Datasource Laravel Package

cakephp/datasource

CakePHP Datasource provides the core datasource layer used by CakePHP ORM, defining interfaces and base classes for connections, schema/statement handling, and query execution. A foundation for building and integrating database drivers and custom datasources.

View on GitHub
Deep Wiki
Context7

[READ-ONLY] Provides connection managing and traits for Entities and Queries that can be reused for different datastores. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp

Frequently asked questions about Datasource
Can I use cakephp/datasource to replace Laravel’s Eloquent for multi-database support?
No, not directly. While cakephp/datasource supports multiple data sources, it’s designed for CakePHP’s architecture and lacks native Laravel integration (e.g., Service Providers, Facades). You’d need to build custom wrappers or accept architectural drift. For Laravel, consider spatie/laravel-multi-database or Doctrine DBAL instead.
How do I install cakephp/datasource in a Laravel project?
Run `composer require cakephp/datasource`. However, installation alone won’t integrate it with Laravel. You’ll need to manually bridge it with Laravel’s Service Container, Facades, or create custom Eloquent macros. No official Laravel integration exists.
Does cakephp/datasource work with Laravel’s Query Builder?
No, it’s incompatible by design. cakephp/datasource uses CakePHP’s query traits and interfaces, which conflict with Laravel’s Query Builder and Eloquent. Use it only for read-only operations or as a standalone layer outside Laravel’s core.
What Laravel versions does cakephp/datasource support?
The package itself has no Laravel-specific dependencies, but integration requires manual work. Test thoroughly with your Laravel version (8.x–10.x) since it’s not officially supported. CakePHP’s core (which this package depends on) may introduce breaking changes.
Can I use cakephp/datasource for MongoDB or Redis in Laravel?
Technically yes, but with significant effort. cakephp/datasource is database-agnostic, but you’d need to implement custom drivers and bridge them to Laravel’s connection system. For simpler solutions, use Laravel’s native database connectors or packages like jenssegers/mongodb.
How does cakephp/datasource handle database connections compared to Laravel?
Laravel’s `config/database.php` and `DB` facade manage connections natively, while cakephp/datasource provides a lower-level, read-only abstraction. If you need connection pooling or multi-datasource, you’d duplicate Laravel’s logic or rewrite it to fit cakephp/datasource’s traits.
Will cakephp/datasource slow down my Laravel app?
Potentially, due to indirect method calls from traits and CakePHP’s abstraction layer. Benchmark against Laravel’s native solutions (e.g., Eloquent, Query Builder). If performance is critical, avoid this package unless absolutely necessary.
Are there alternatives to cakephp/datasource for Laravel’s multi-database needs?
Yes. For Laravel, prioritize spatie/laravel-multi-database (for SQL) or Doctrine DBAL (for polyglot persistence). If you’re migrating from CakePHP, evaluate whether rewriting data access in Laravel-native patterns (e.g., repositories) is more sustainable.
How do I test cakephp/datasource in a Laravel project?
Mock CakePHP-specific traits (e.g., `Entity`, `Query`) using PHPUnit/Pest, but expect complexity due to Laravel’s DI system. Test connection handling and query execution in isolation, as integration tests may require custom test doubles for Laravel’s Facades.
Is cakephp/datasource actively maintained for Laravel use?
No. It’s a CakePHP package with no Laravel-specific maintenance. CakePHP’s core (which this depends on) may evolve independently, risking compatibility issues. Use it only if your team has CakePHP expertise or for legacy system integration.
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.
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor