xavierleune / ting
Ting : a lightweight datamapper
Requires
- php: >=8.1
- 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
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- pimple/pimple: ^3.0
- rector/rector: ^2.1
- rector/type-perfect: ^2.1
- symfony/cache: ^6.0 || ^7.0
- symfony/uid: ^6.0 || ^7.0
- tomasvotruba/type-coverage: ^2.0
Suggests
- brick/geo: Allow support of MariaDB Geometry type
- pimple/pimple: Service container.
- symfony/uid: To work with Uuid.
Provides
None
Conflicts
None
Replaces
None
- dev-main
- 4.0.0-rc.1
- 3.x-dev
- 3.15.0
- 3.14.0
- 3.13.0
- 3.12.1
- 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.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.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/unit-of-work-review-medium
- dev-fix/drivers-review-medium
- dev-fix/hydrators-review-medium
- dev-docs/changelog-3x-releases
- dev-fix/hydrator-relational-order
- dev-fix/drivers-review-high
- dev-fix/unit-of-work-review-high
- dev-fix/primary-key-default-serializer
- dev-fix/serialize-primary-keys-in-writes
- dev-feature/property-names
- dev-feature/property-names-3.x
- dev-feature/primary-replica-3.x-v2
- dev-feature/primary-replica
- dev-chore/sample-4.0
- dev-fix/hydrator-aggregator-last-group
- dev-chore/remove-fake-cache-logger
- dev-fix/pgsql-statement-destructor
- dev-fix/metadata-without-entity
- dev-docs/typing-audit-bc
- dev-fix/backed-enum-serialize-string
- dev-fix/mysqli-prepared-dml-result
- dev-fix/pgsql-typing-regressions
- dev-fix/connection-without-credentials
- dev-fix/hydrator-object-schema-precedence
- dev-chore/repository-factory-serializer
- dev-fix/driver-default-name-database
- dev-fix/cache-without-pool
- dev-chore/remove-cached-query-set-version
- dev-fix/driver-named-parameters
- dev-fix/hydrator-object-schema-pgsql
- dev-fix/unit-of-work-unchanged-save
- dev-fix/debug-cache-master
- dev-fix/unit-of-work
- dev-feature/docs
- dev-feature/remove-services
- dev-feature/symfony-cache-contracts
- dev-feature/4.x
- dev-feature/symfony8-phpunit
- dev-feature/worker-mode
- dev-feature/poc-simple
- dev-fix/identity-map
- dev-master
- dev-feature/reconnect
- dev-feature/backed-enum
- dev-fix/ping
- dev-fix/hydrator-relational-without-default
- dev-fix/php84
- dev-feature/support-public-properties
- dev-fix/deprecated
- dev-feature/more-serializer
- dev-feature/attributes
- dev-fix/query-generator-null
- dev-feature/collection-serializable
- dev-feature/remove-pimple
This package is auto-updated.
Last update: 2026-10-05 14:27:34 UTC
README
ℹ️ This is a fork of ccmbenchmark/ting. The upstream project is no longer maintained publicly. Development continues here as
xavierleune/ting. PHP namespaces (CCMBenchmark\Ting\...) are unchanged. Coming fromccmbenchmark/ting3.x, update the package name in yourcomposer.jsonand follow UPGRADE-4.0.md.
Ting - PHP Datamapper
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
Installation
composer require xavierleune/ting
Ting requires PHP 8.2 or later. With Symfony, install ting_bundle, which wires everything in the container. Without a framework, see Getting started.
Retrieve object by ID
// $cityRepository is a \sample\src\model\CityRepository, given by the container (or a RepositoryFactory) $city = $cityRepository->get(3);
Simple query
// 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); }
Prepared statement
// Simple query: $query = $cityRepository->getQuery('SQL Statement'); // Prepared statement: $query = $cityRepository->getPreparedQuery('SQL Statement');
Query builder provided by aura/sqlquery
$queryBuilder = $cityRepository->getQueryBuilder($cityRepository::QUERY_SELECT); $queryBuilder ->cols(['cit_id', 'cit_name as name']) ->from('t_city_cit'); $query = $cityRepository->getQuery($queryBuilder->getStatement());