{"id":16675077,"url":"https://github.com/compositephp/php-datamapper-benchmark","last_synced_at":"2026-03-10T17:05:47.531Z","repository":{"id":214214558,"uuid":"735624894","full_name":"compositephp/php-datamapper-benchmark","owner":"compositephp","description":"PHP ORM Performance Analysis: Benchmarking and comparing Doctrine, Laravel, Cycle, and CompositePHP ORMs in CRUD operations on MySQL. Essential insights on speed and memory efficiency for PHP developers.","archived":false,"fork":false,"pushed_at":"2024-07-13T21:45:32.000Z","size":19,"stargazers_count":4,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-12T06:07:23.174Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/compositephp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2023-12-25T15:35:38.000Z","updated_at":"2024-07-13T21:45:34.000Z","dependencies_parsed_at":"2023-12-27T13:29:01.495Z","dependency_job_id":"6a4321a1-81dd-4a55-8a10-4a417a1c3290","html_url":"https://github.com/compositephp/php-datamapper-benchmark","commit_stats":null,"previous_names":["compositephp/php-orm-benchmark","compositephp/php-datamapper-benchmark"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/compositephp/php-datamapper-benchmark","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compositephp%2Fphp-datamapper-benchmark","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compositephp%2Fphp-datamapper-benchmark/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compositephp%2Fphp-datamapper-benchmark/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compositephp%2Fphp-datamapper-benchmark/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/compositephp","download_url":"https://codeload.github.com/compositephp/php-datamapper-benchmark/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/compositephp%2Fphp-datamapper-benchmark/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30343841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-10T15:55:29.454Z","status":"ssl_error","status_checked_at":"2026-03-10T15:54:58.440Z","response_time":106,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2024-10-12T12:45:24.474Z","updated_at":"2026-03-10T17:05:47.512Z","avatar_url":"https://github.com/compositephp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP DataMappers Benchmark\n\n## Overview\nThis repository contains benchmarks for some of the most popular PHP DataMapper's, used as a reference for performance \noptimizations in my personal project [compositephp/db](https://github.com/compositephp/db). \n\nThe projects benchmarked include:\n- [Doctrine](https://www.doctrine-project.org/)\n- [Laravel Eloquent](https://laravel.com/docs/8.x/eloquent)\n- [Cycle ORM](https://cycle-orm.dev/)\n- [Composite DB](https://github.com/compositephp/db/)\n- [PHPFUI ORM](https://github.com/phpfui/ORM)\n\n## Methodology\n* The benchmark executes 10 000 CRUD (Create, Read, Update, Delete) operations to assess the performance.\n* The benchmark tests focus exclusively on the 'DataMapper' component of each project, employing simple queries that do \nnot involve relationships, foreign keys, or joins.\n\nOperations include:\n1. Creating a new record in the database.\n2. Reading the record by primary key.\n3. Updating one field for the found record.\n4. Deleting the record.\n\n### Database\n- MySQL 8.0\n- Table used for the benchmark:\n```sql\nCREATE TABLE IF NOT EXISTS Users\n(\n    `id` INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,\n    `name` VARCHAR(255) NOT NULL,\n    `age` INTEGER NOT NULL,\n    `microtime` FLOAT NOT NULL,\n    `created_at` TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL\n);\n```\n\n## Results\n\n### MacBook Pro with Apple M2 Pro Chip and 12‑Core CPU:\n\n| Project          | Time (seconds) | Memory Kb | Memory Peak Mb |\n|------------------|----------------|-----------|----------------|\n| Laravel Eloquent | 61.51          | 4950.91   | 8.063          |\n| Cycle ORM        | 44.32          | 288.15    | 7.007          |\n| Doctrine         | 37.45          | 870.24    | 6.408          |\n| CompositeDB      | 24.71          | 143.46    | 2.217          |\n| PHPFUI ORM       | 20.43          | 109.37    | 2.196          |\n\n## Running Locally\n\n### Requirements\n* PHP 8.1+\n* Docker\n* Composer\n* PDO_MySQL extension\n\n### Steps\n1. Clone or download this repository\n2. Run `composer update`\n3. Execute `docker-compose up`\n4. Run benchmarks for each DataMapper separately:\n   * `php src/test-laravel.php`\n   * `php src/test-cycle.php`\n   * `php src/test-doctrine.php`\n   * `php src/test-composite.php`\n   * `php src/test-PHPFUI.php`\n\n## Note\nThis is a synthetic benchmark focused on speed and memory consumption and does not compare the feature list of the projects. \nFeel free to note any problems, inaccuracies, or shortcomings in using these projects and make a pull request to fix them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompositephp%2Fphp-datamapper-benchmark","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcompositephp%2Fphp-datamapper-benchmark","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcompositephp%2Fphp-datamapper-benchmark/lists"}