ccmbenchmark / ting
Ting : a lightweight datamapper
3.9.1
2024-07-19 14:35 UTC
Requires
- php: >=7.1
- aura/sqlquery: ^2.6
- doctrine/cache: ^1.6
- pimple/pimple: ^3.0
Requires (Dev)
- ext-mysqli: *
- ext-pgsql: *
- atoum/atoum: ^4.0
- atoum/stubs: ^2.0
- brick/geo: ^0.5.1
Suggests
- brick/geo: Allow support of MariaDB Geometry type
- dev-master
- 4.x-dev
- 3.9.1
- 3.9.0
- 3.8.1
- 3.8.0
- 3.7.3
- 3.7.2
- 3.7.1
- 3.7.0
- 3.6.2
- 3.6.1
- 3.6.0
- 3.5.8
- 3.5.7
- 3.5.6
- 3.5.5
- 3.5.4
- 3.5.3
- 3.5.2
- 3.5.1
- 3.5.0
- 3.5.0-beta.2
- 3.5.0-beta
- 3.4.x-dev
- 3.4.4
- 3.4.3
- 3.4.2
- 3.4.1
- 3.4.0
- 3.3.0
- 3.2.1
- 3.2.0
- 3.1.1
- 3.1.0
- 3.0.0
- 2.7.0
- 2.6.2
- 2.6.1
- 2.6.0
- 2.5.1
- 2.5.0
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.0
- 2.0.0
- 1.1.x-dev
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.0
- 1.0-beta
- 1.0-alpha
- dev-fix/mysqli-driver-ping-exception
- dev-feature/phpstan
- dev-feature/weakmap
- dev-feature/typehint
- dev-feature/serialize-datetimeimmutable
- dev-chore/setup-phpstan
- dev-fix/entity-identification-on-hydratation
- dev-fix/tests-8.1
- dev-feature/use_root_ns_for_func_calls
- dev-fix/pgsql-distinct
- dev-ci/php81
- dev-update_changelog
- dev-feature/add-query-order-limit
- dev-fix/ch/fix-mysql-driver
- dev-feature/ch/CCM-3208-add-timezone-on-database-connection
- dev-feature/ch/CCM-2809-allow-array-in-mysql
- dev-feature/jv/CCM-1458-corrections-des-retour-derreur-1
- dev-test/gitlab
- dev-feature/issue-11-pimple-suggest
- dev-feature/test-continuousphp
- dev-feature/FWPHP-243-shippable
This package is auto-updated.
Last update: 2024-11-19 15:30:58 UTC
README
Ting is a simple DataMapper implementation for PHP. It runs with MySQL and PostgreSQL and is under Apache-2.0 licence.
It has some distinctive features and design choices :
- Pure PHP implementation (no PDO, no XML)
- No abstraction layer : you speak the language of your RDBMS
- Fast, low memory consumption
- Simple to use, simple to extend
You can read this few examples, or go to the Documentation or see more samples.
Retrieve object by ID
<?php
$cityRepository = $services->get('RepositoryFactory')->get('\sample\src\model\CityRepository');
## Retrieve city by id :
$city = $cityRepository->get(3);
Simple query
<?php
# This query supports the same syntax as prepared statements, but it'll be a regular query
$query = $cityRepository->getQuery(
"select cit_id, cit_name, c.cou_code, cit_district, cit_population, last_modified,
co.cou_code, cou_name, cou_continent, cou_region, cou_head_of_state
from t_city_cit as c
inner join t_country_cou as co on (c.cou_code = co.cou_code)
where co.cou_code = :code limit 3"
);
$collection = $query->setParams(['code' => 'FRA'])->query();
foreach ($collection as $result) {
var_dump($result);
echo str_repeat("-", 40) . "\n";
}
Prepared Statement
<?php
// Simple query :
$query = $cityRepository->getQuery('SQL Statement');
// Prepared statement :
$query = $cityRepository->getPreparedQuery('SQL Statement');
QueryBuilder provided by aura/sqlquery
<?php
$queryBuilder = $cityRepository->getQueryBuilder($cityRepository::QUERY_SELECT);
$queryBuilder
->cols(['cit_id', 'cit_name as name'])
->from('t_city_cit');
$query = $cityRepository->getQuery($queryBuilder->getStatement());