{"id":29017874,"url":"https://github.com/cakephp/datasource","last_synced_at":"2025-06-25T23:07:21.295Z","repository":{"id":21254021,"uuid":"24569577","full_name":"cakephp/datasource","owner":"cakephp","description":"[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","archived":false,"fork":false,"pushed_at":"2025-05-17T03:10:22.000Z","size":17478,"stargazers_count":47,"open_issues_count":0,"forks_count":7,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-05-17T04:18:31.697Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cakephp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-09-28T20:23:34.000Z","updated_at":"2025-03-18T11:11:27.000Z","dependencies_parsed_at":"2023-01-13T21:22:04.451Z","dependency_job_id":"ed31541f-c3d4-4445-8489-704f9c1bbd47","html_url":"https://github.com/cakephp/datasource","commit_stats":{"total_commits":623,"total_committers":72,"mean_commits":8.652777777777779,"dds":0.7865168539325843,"last_synced_commit":"cc101051e8d601cf6c2895d635ccefecca97ff4e"},"previous_names":[],"tags_count":306,"template":false,"template_full_name":null,"purl":"pkg:github/cakephp/datasource","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Fdatasource","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Fdatasource/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Fdatasource/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Fdatasource/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cakephp","download_url":"https://codeload.github.com/cakephp/datasource/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cakephp%2Fdatasource/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261967132,"owners_count":23237663,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-25T23:07:17.570Z","updated_at":"2025-06-25T23:07:21.282Z","avatar_url":"https://github.com/cakephp.png","language":"PHP","readme":"[![Total Downloads](https://img.shields.io/packagist/dt/cakephp/datasource.svg?style=flat-square)](https://packagist.org/packages/cakephp/datasource)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE.txt)\n\n# CakePHP Datasource Library\n\nThis library contains interfaces for implementing Repositories and Entities using any data source,\na class for managing connections to datasources and traits to help you quickly implement the\ninterfaces provided by this package.\n\n## Repositories\n\nA repository is a class capable of interfacing with a data source using operations such as\n`find`, `save` and  `delete` by using intermediate query objects for expressing commands to\nthe data store and returning Entities as the single result unit of such system.\n\nIn the case of a Relational database, a Repository would be a `Table`, which can be return single\nor multiple `Entity` objects by using a `Query`.\n\nThis library exposes the following interfaces for creating a system that implements the\nrepository pattern and is compatible with the CakePHP framework:\n\n* `RepositoryInterface` - Describes the methods for a base repository class.\n* `EntityInterface` - Describes the methods for a single result object.\n* `ResultSetInterface` - Represents the idea of a collection of Entities as a result of a query.\n\nAdditionally, this package provides a few traits and classes you can use in your own implementations:\n\n* `EntityTrait` - Contains the default implementation for the `EntityInterface`.\n* `QueryTrait` - Exposes the methods for creating a query object capable of returning decoratable collections.\n* `ResultSetDecorator` - Decorates any traversable object, so it complies with `ResultSetInterface`.\n\n\n## Connections\n\nThis library contains a couple of utility classes meant to create and manage\nconnection objects. Connections are typically used in repositories for\ninterfacing with the actual data source system.\n\nThe `ConnectionManager` class acts as a registry to access database connections\nyour application has. It provides a place that other objects can get references\nto existing connections. Creating connections with the `ConnectionManager` is\neasy:\n\n```php\nuse Cake\\Datasource\\ConnectionManager;\n\nConnectionManager::config('connection-one', [\n    'className' =\u003e 'MyApp\\Connections\\CustomConnection',\n    'param1' =\u003e 'value',\n    'param2' =\u003e 'another value'\n]);\n\nConnectionManager::config('connection-two', [\n    'className' =\u003e 'MyApp\\Connections\\CustomConnection',\n    'param1' =\u003e 'different value',\n    'param2' =\u003e 'another value'\n]);\n```\n\nWhen requested, the `ConnectionManager` will instantiate\n`MyApp\\Connections\\CustomConnection` by passing `param1` and `param2` inside an\narray as the first argument of the constructor.\n\nOnce configured connections can be fetched using `ConnectionManager::get()`.\nThis method will construct and load a connection if it has not been built\nbefore, or return the existing known connection:\n\n```php\nuse Cake\\Datasource\\ConnectionManager;\n$conn = ConnectionManager::get('master');\n```\n\nIt is also possible to store connection objects by passing the instance directly to the manager:\n\n```php\nuse Cake\\Datasource\\ConnectionManager;\n$conn = ConnectionManager::config('other', $connectionInstance);\n```\n\n## Documentation\n\nPlease make sure you check the [official API documentation](https://api.cakephp.org/4.x/namespace-Cake.Datasource.html)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcakephp%2Fdatasource","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcakephp%2Fdatasource","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcakephp%2Fdatasource/lists"}