ccmbenchmark / ting
Ting : a lightweight datamapper
Installs: 114 597
Dependents: 3
Suggesters: 0
Security: 0
Stars: 2
Watchers: 6
Forks: 8
pkg:composer/ccmbenchmark/ting
Requires
- php: >=8.0
 - aura/sqlquery: ^2.6 || ^3.0
 - doctrine/cache: ^1.6
 - symfony/property-access: ^6.0 || ^7.0
 
Requires (Dev)
- ext-mysqli: *
 - ext-pgsql: *
 - atoum/atoum: ^4.0
 - atoum/stubs: ^2.0
 - brick/geo: ^0.5.1
 - pimple/pimple: ^3.0
 - symfony/cache: ^6.0 || ^7.0
 - symfony/uid: ^6.0 || ^7.0
 
Suggests
- brick/geo: Allow support of MariaDB Geometry type
 - pimple/pimple: Service container.
 - symfony/uid: To work with Uuid.
 
- dev-master
 - 4.x-dev
 - 3.12.0
 - 3.11.0
 - 3.10.6
 - 3.10.5
 - 3.10.4
 - 3.10.3
 - 3.10.2
 - 3.10.1
 - 3.10.0
 - 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-chore/typehint
 - dev-fix/v4-post-merge-v3
 - dev-feature/value-object-hydrator
 - dev-chore/typehint-2
 - dev-feature/merge-getByCriteriaWithOrderAndLimit-getByCriteria
 - dev-feature/support-php-81
 - dev-feature/support-natives-pgsql-classes-drop-php-80
 - dev-feature/docs-v4
 - dev-feature/phpstan
 - dev-feature/vo-hydrator-driver-fetch-object
 - dev-feature/vo-hydrator-simple
 - dev-feature/dx-querybuilder
 - dev-feature/vo-hydrator
 - dev-fix/avoid-iterator-notice
 - dev-fix/metadatainitializer-generics
 - dev-chore/bump-aura-sqlquery
 - dev-feature/serialization-without-listener
 - dev-feature/debuginfo
 - dev-fix/add-exception-when-pimple-is-missing
 - dev-feature/serialization-interface
 - dev-feature/remove-metadata-setter-getter
 - dev-chore/remove-uuid-generation
 - dev-fix/remove-dynamic-property
 - dev-feature/remove-deprecated
 - dev-chore/add-phpstan
 - dev-feature/use-weakmap
 - dev-feature/datetimeimmutable-serialization
 - dev-fix/mysqli-driver-ping-exception
 - 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: 2025-10-30 14:42:25 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());