{"id":19985230,"url":"https://github.com/taq/torm","last_synced_at":"2025-08-20T03:31:11.595Z","repository":{"id":54353086,"uuid":"10299725","full_name":"taq/torm","owner":"taq","description":"Just another simple PHP ORM. You can use it, but don't ask me why I made it. :-)","archived":false,"fork":false,"pushed_at":"2022-03-08T11:13:01.000Z","size":367,"stargazers_count":95,"open_issues_count":4,"forks_count":30,"subscribers_count":22,"default_branch":"master","last_synced_at":"2024-12-13T11:47:31.023Z","etag":null,"topics":["activerecord","orm","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/taq.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-05-26T15:33:41.000Z","updated_at":"2024-07-18T21:09:21.000Z","dependencies_parsed_at":"2022-08-13T13:10:12.202Z","dependency_job_id":null,"html_url":"https://github.com/taq/torm","commit_stats":null,"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taq%2Ftorm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taq%2Ftorm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taq%2Ftorm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/taq%2Ftorm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/taq","download_url":"https://codeload.github.com/taq/torm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230388131,"owners_count":18217755,"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":["activerecord","orm","php"],"created_at":"2024-11-13T04:23:57.548Z","updated_at":"2024-12-19T06:09:26.416Z","avatar_url":"https://github.com/taq.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TORM\n\n| :warning: **WARNING** This software is [abandonware](https://en.wikipedia.org/wiki/Abandonware). As the creator and maintainer, I don't even use PHP _for years_, so, I can't support it anymore. It should work ok for PHP untill version 7, but seems that with 8.1 there are some alerts. Feel free to fork it and keep it going. |\n| --- |\n\nJust another simple ORM for PHP. You can use it, but don't ask why I made it. Right? :-)\n\n## Usage\n\nTake a look on the [Github Wiki](https://github.com/taq/torm/wiki) for documentation, but let me show the basics here:\n\n```php\n\u003c?php\n// open the PDO connection and set it\n$con = new PDO(\"sqlite:database.sqlite3\");\nTORM\\Connection::setConnection($con);\nTORM\\Connection::setDriver(\"sqlite\");\n\n// define your models - an User class will connect to an users table\nclass User extends TORM\\Model {};\nclass Ticket extends TORM\\Model {};\n\n// create some validations\nUser::validates(\"name\",  [\"presence\"     =\u003e true]);\nUser::validates(\"email\", [\"presence\"     =\u003e true]);\nUser::validates(\"email\", [\"uniqueness\"   =\u003e true]);\nUser::validates(\"id\",    [\"numericality\" =\u003e true]);\n\n// create some relations\nUser::hasMany(\"tickets\");\nUser::hasOne(\"account\");\nTicket::belongsTo(\"user\");\n\n// this will create a new user\n$user = new User();\n$user-\u003ename  = \"John Doe\";\n$user-\u003eemail = \"john@doe.com\";\n$user-\u003elevel = 1;\n$user-\u003esave();\n\n// this will find the user using its primary key\n$user = User::find(1);\n\n// find some users\n$users = User::where([\"level\" =\u003e 1]);\n\n// find some users, using more complex expressions\n// the array first element is the query, the rest are values\n$users = User::where([\"level \u003e= ?\", 1]); \n\n// updating users\nUser::where([\"level\" =\u003e 1])-\u003eupdateAttributes([\"level\" =\u003e 3]);\n\n// using fluent queries\n$users = User::where([\"level\" =\u003e 1])-\u003elimit(5)-\u003eorder(\"name desc\");\n\n// listing the user tickets\nforeach($user-\u003etickets as $ticket) {\n   echo $ticket-\u003edescription;\n}\n\n// show user account info\necho $user-\u003eaccount-\u003enumber; \n?\u003e\n```\n\n## Testing\n\n### SQLite\n\nFirst, use `composer update` to make sure everything is ok with all the\npackages. Then, go to the `test` directory and run `run`. It will requires the\n[SQLite driver](http://php.net/manual/en/ref.pdo-sqlite.php) so make sure it is\navailable. If not, check the `php.ini` dir found with\n\n```bash\n$ php -r 'phpinfo();' | grep 'php.ini'\nConfiguration File (php.ini) Path =\u003e /etc/php/7.1/cli\nLoaded Configuration File =\u003e /etc/php/7.1/cli/php.ini\n```\n\nand, if not found there or on the `conf.d` on the same location the `php.ini`\nfile is, it can be installed, on Ubuntu, using:\n\n```bash\n$ sudo apt install php-sqlite3\n```\n\n### Multibyte strings, locale and YAML\n\n```\n$ sudo apt install php-mbstring php-intl php-yaml\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaq%2Ftorm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaq%2Ftorm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaq%2Ftorm/lists"}