{"id":15295789,"url":"https://github.com/hexmakina/crudites","last_synced_at":"2025-04-13T18:22:59.517Z","repository":{"id":47943799,"uuid":"367336985","full_name":"HexMakina/Crudites","owner":"HexMakina","description":"Another PHP/xxSQL abstraction layer","archived":false,"fork":false,"pushed_at":"2025-03-24T21:45:48.000Z","size":541,"stargazers_count":2,"open_issues_count":16,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T09:11:25.731Z","etag":null,"topics":["crud","crud-operation","introspection-query","mariadb","mariadb-database","mysql","mysql-database","php","php7","sql"],"latest_commit_sha":null,"homepage":"","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/HexMakina.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-14T11:07:35.000Z","updated_at":"2025-03-10T00:12:52.000Z","dependencies_parsed_at":"2023-10-23T15:42:08.600Z","dependency_job_id":"98ae69f5-b222-4d04-b434-6717a87be5bd","html_url":"https://github.com/HexMakina/Crudites","commit_stats":{"total_commits":412,"total_committers":2,"mean_commits":206.0,"dds":0.3786407766990292,"last_synced_commit":"2c9a4769edf1e52687c763093482dbc8ccc834ac"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HexMakina%2FCrudites","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HexMakina%2FCrudites/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HexMakina%2FCrudites/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HexMakina%2FCrudites/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HexMakina","download_url":"https://codeload.github.com/HexMakina/Crudites/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248759139,"owners_count":21157097,"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":["crud","crud-operation","introspection-query","mariadb","mariadb-database","mysql","mysql-database","php","php7","sql"],"created_at":"2024-09-30T18:08:12.679Z","updated_at":"2025-04-13T18:22:59.487Z","avatar_url":"https://github.com/HexMakina.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/HexMakina/Crudites/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/HexMakina/Crudites/?branch=main)\n\u003cimg src=\"https://img.shields.io/badge/PHP-7.4-brightgreen\" alt=\"PHP 7.04 Required\" /\u003e\n[![License](http://poser.pugx.org/hexmakina/crudites/license)](https://packagist.org/packages/hexmakina/crudites)\n[![Latest Stable Version](http://poser.pugx.org/hexmakina/crudites/v)](https://packagist.org/packages/hexmakina/crudites)\n[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/HexMakina/Crudites/badges/quality-score.png?b=main)](https://scrutinizer-ci.com/g/HexMakina/Crudites/?branch=main)\n\n# Crudités ?\n\n_\"Crudités, it's a cup of carrots sticks\"_\n\n**C**reate - **R**etrieve - **U**pdate - **D**elete - **I**ntrospection, **T**ransaction, **E**rrors \u0026 **S**chema\n```\nCRUDITES\nC  CRUD\nR  Relations\nU  Uniques as PK\nD  Disable, Don't Delete\nI  Introspect \u0026 Inspect\nT  Transactions and Tracking\nE  Errors\nS  Security\n```\n\nCrudites is a PHP PDO wrapper\n\n# Exception\n`CruditeException` extends `\\Exception` and is thrown by all Crudites components\n\n\n# Source\nThe Source object stores and validates a DSN (Data Source Name)\n\n## Instantiation\nIt is created using a DSN string, the constructor will extract and validates all the required information\n\n`mysql:host=localhost;dbname=testdb`  \n`mysql:host=localhost;port=3307;dbname=testdb`  \n\n## Exceptions\nIf the database's name or a proper driver cannot be found, a `CruditesException` is thrown with the message\n- `_DSN_NO_DBNAME_`\n- `_DSN_NO_DRIVER_`\n- `_DSN_UNAVAILABLE_DRIVER_`\n\n## Properties\nThe object stores\n1. The DSN string (constructor parameter)\n2. The database name (extracted from the DSN string)\n\nThe object validates the driver's name (extracted from DSN string) by calling `\\PDO::getAvailableDrivers()`\n\n## Methods\nWhen instantiated, the object provides two methods:\n1. `DSN()`, returns the DSN string (string)\n2. `name()`, returns the database name (string)\n\n\n# Connection\nThe Connection object relies on PDO to connect to a database.\n\n## Instantiation\n\nIt is created using\n1. a DSN string\n2. a username (optional)\n3. a password (optional)\n4. a list of driver options (optional)\n\n## Exceptions\nThe DSN string is validated using the Source object, and may throw `CruditesException`\nA PDO object is created and may throw a `PDOException`\n\n### Default Options\n```\n\\PDO::ATTR_ERRMODE =\u003e \\PDO::ERRMODE_EXCEPTION, // the one option you cannot change\n\\PDO::ATTR_CASE =\u003e \\PDO::CASE_NATURAL,\n\\PDO::ATTR_DEFAULT_FETCH_MODE =\u003e \\PDO::FETCH_ASSOC\n```\n\n**The PDO::ATTR_ERRMODE is the only option that cannot be overridden**\n\n\n## Properties\nThe object stores:\n1. a Source object;\n2. a database name (string)\n3. a PDO object\n\n## Methods\nWhen instantiated, the object provides the following methods:\n\n### Database related\n+ useDatabase(string name)\n+ driverName()\n+ databaseName()\n\n### Query execution\n+ prepare(string statement)\n+ query()\n+ alter()\n+ lastInsertId(string name)\n+ errorInfo()\n+ errorCode()\n\n### Transactions\n+ transact()\n+ commit()\n+ rollback()\n\n\n# Database\nThe object represent a SQL database, handles connection and introspection.\n\nIntrospection is a two step process:\n1. The `INFORMATION_SCHEMA` is queried and FK and UNIQUE constraints are stored in the object properties upon instantiation\n2. The table introspection, called inspection, is executed on demand using `inspect(table_name)` and the results are stored in the table cache property. Inspection uses introspection to create a complete representation of a table: fields, data type, defaults \u0026 constraints\n\n## Instantiation\nIt is created using a `Connection` object. The connection is stored and the database instrospection is executed.\n\n## Properties\n+ `Connection` object\n+ Table cache (array)\n+ List of foreign keys, indexed by table (array)\n+ List of unique constraints, indexed by table (array)\n\n## Methods\nWhen instantiated, the object provides the following methods:\n+ name(), returns the database name\n+ connection(), returns the `Connection` object\n+ inspect(string table_name), return a Table object\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexmakina%2Fcrudites","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexmakina%2Fcrudites","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexmakina%2Fcrudites/lists"}