{"id":17134531,"url":"https://github.com/tiagocavalcante/connection","last_synced_at":"2026-01-13T23:21:49.757Z","repository":{"id":56957392,"uuid":"271868733","full_name":"TiagoCavalcante/Connection","owner":"TiagoCavalcante","description":"A secure, multiple database ORM for PHP","archived":true,"fork":false,"pushed_at":"2022-11-15T19:45:07.000Z","size":151,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-04T20:34:03.238Z","etag":null,"topics":["composer","database","php","sql"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/connection/connection","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TiagoCavalcante.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":"2020-06-12T18:49:49.000Z","updated_at":"2024-11-21T17:18:43.000Z","dependencies_parsed_at":"2023-01-21T19:33:22.864Z","dependency_job_id":null,"html_url":"https://github.com/TiagoCavalcante/Connection","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TiagoCavalcante%2FConnection","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TiagoCavalcante%2FConnection/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TiagoCavalcante%2FConnection/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TiagoCavalcante%2FConnection/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TiagoCavalcante","download_url":"https://codeload.github.com/TiagoCavalcante/Connection/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240271523,"owners_count":19774859,"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":["composer","database","php","sql"],"created_at":"2024-10-14T19:45:01.623Z","updated_at":"2026-01-13T23:21:49.724Z","avatar_url":"https://github.com/TiagoCavalcante.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Connection\nA secure, multiple database ORM for PHP\n\n## Getting started\nFirst, check if you meet all of the **prerequisites**, then **install**\n### Prerequisites\n#### MySQL/MariaDB prerequisites\n1. Install `MySQL`/`MariaDB` and configure it\n2. In the file `php.ini` (if it doesn't exists rename the file `php.ini-development` to `php.ini`) remove the `;` before the `extension=pdo_mysql` (it's probably in the line 939)\n#### PostgreSQL prerequisites\n1. Install `PostgreSQL` and configure it or crete a `PostgreSQL` database on [Heroku](https://data.heroku.com/)\n2. In the file `php.ini` (if it doesn't exists rename the file `php.ini-development` to `php.ini`) remove the `;` before the `extension=pdo_pgsql` (it's probably in the line 942)\n### SQLite prerequisites\n1. Install `SQLite3` with the following command: `sudo apt-get install sqlite3`\n### Instalation\nTo install you need to:\n  * execute the following command to install with Composer: `composer require connection/connection`\n  * execute the following command to install with Git: `git clone https://github.com/TiagoCavalcanteTrindade/Connection`\n### First sample\n`sample.php`:\n```php\n\u003c?php\n  require_once 'env.php';\n  require_once 'vendor/autoload.php';\n\n  # initialize the database\n  $conn = new Connection\\Connection();\n\n  # create the table `posts` with the fields `title` and `text`\n  $conn-\u003etable('posts')\n    -\u003ecreate()\n    -\u003ecolumns([\n      'title' =\u003e 'TEXT',\n      'text' =\u003e 'TEXT'\n    ])\n    -\u003erun();\n\n  for ($i = 0; $i \u003c= 9; $i++) {\n    # insert into the table `posts`\n    $conn-\u003etable('posts')\n      -\u003einsert()\n      -\u003ewhat('title', 'text')\n      -\u003evalues('Title', 'Text')\n      -\u003erun();\n  }\n\n  # go through the array of results\n  foreach ($conn-\u003etable('posts')-\u003eselect()-\u003ewhat('title', 'text')-\u003erun() as $result) {\n    # echo the `title` and the `text` of a post\n    echo \"Title: {$result['title']}\\nText: {$result['text']}\\n\";\n  }\n\n  # colse the connection (necessary for security)\n  $conn-\u003eclose();\n?\u003e\n```\n`env.php`:\n```php\n\u003c?php\n  putenv('name=SQLite');\n  putenv('database=database.sqlite3');\n?\u003e\n```\nAnd to execute:\n```bash\nphp sample.php\n```\n\n## Tests\n### Before init\nBefore init you need to:\n  * execute the following command: `composer install`\n  * add a `env file`:\n    * all `envs` need to be defined with `putenv`, e.g.: `putenv('name=SQLite')`\n    * all `envs` are case sensitive\n    * all `env file` need to have the `env` *name*, its possible values are: `MySQL` (for MySQL and MariaDB), `PgSQL` and `SQLite`\n  * all `env file` need to have the `env` *database*\n  * the specific `envs` for each database are:\n    * `MySQL`/`MariaDB`: *host*, *port*, *user* and *password*\n    * `PgSQL`: *host*, *port*, *user* and *password*\n  * grant perssion to execute `phpunit` with the following command: `chmod 777 vendor/bin/phpunit`\n  * grant permission to execute the testing script with the following command: `chmod 777 tests.sh`\n\n### Execute the tests\n* Execute all tests:\n  * you don't need to edit `env.php` for every database, it's autmated by a script, you just need to create a file named `database.env.php` for each `database`\n  * execute the script: `./test.sh`\n* Execute `autoload.php` tests:\n  * execute the following command: `./vendor/bin/phpunit tests/AutoloadFileTest.php`\n* Execute `Connection` tests for specific database:\n  * add `env.php` file\n  * execute the following command: `./vendor/bin/phpunit tests/ConnectionClassTest.php`\n\n## Documentation\nAccess the [documentation](https://github.com/TiagoCavalcanteTrindade/Connection/wiki)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagocavalcante%2Fconnection","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftiagocavalcante%2Fconnection","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftiagocavalcante%2Fconnection/lists"}