{"id":21467417,"url":"https://github.com/elusivecodes/fyreschema","last_synced_at":"2025-10-15T11:13:22.527Z","repository":{"id":56982778,"uuid":"448506555","full_name":"elusivecodes/FyreSchema","owner":"elusivecodes","description":"FyreSchema is a free, open-source database schema library for PHP.","archived":false,"fork":false,"pushed_at":"2024-11-08T12:33:53.000Z","size":203,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-11-08T13:07:20.762Z","etag":null,"topics":["database","mysql","php","postgreql","schema","sqlite"],"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/elusivecodes.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":"2022-01-16T09:14:36.000Z","updated_at":"2024-11-08T12:33:43.000Z","dependencies_parsed_at":"2023-12-17T01:26:35.204Z","dependency_job_id":"591bb49f-9a54-40ea-8e56-b8bc4f9bc739","html_url":"https://github.com/elusivecodes/FyreSchema","commit_stats":{"total_commits":13,"total_committers":2,"mean_commits":6.5,"dds":0.07692307692307687,"last_synced_commit":"55acaa8612661ccde88c0bd60bc8ee0bfeb715c7"},"previous_names":[],"tags_count":32,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreSchema","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreSchema/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreSchema/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elusivecodes%2FFyreSchema/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elusivecodes","download_url":"https://codeload.github.com/elusivecodes/FyreSchema/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226017479,"owners_count":17560521,"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":["database","mysql","php","postgreql","schema","sqlite"],"created_at":"2024-11-23T08:17:56.012Z","updated_at":"2025-10-15T11:13:22.491Z","avatar_url":"https://github.com/elusivecodes.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FyreSchema\r\n\r\n**FyreSchema** is a free, open-source database schema library for *PHP*.\r\n\r\n\r\n## Table Of Contents\r\n- [Installation](#installation)\r\n- [Basic Usage](#basic-usage)\r\n- [Methods](#methods)\r\n- [Schemas](#schemas)\r\n- [Tables](#tables)\r\n    - [Mysql Tables](#mysql-tables)\r\n- [Columns](#columns)\r\n    - [Mysql Columns](#mysql-columns)\r\n- [Indexes](#indexes)\r\n- [Foreign Keys](#foreign-keys)\r\n\r\n\r\n\r\n## Installation\r\n\r\n**Using Composer**\r\n\r\n```\r\ncomposer require fyre/schema\r\n```\r\n\r\nIn PHP:\r\n\r\n```php\r\nuse Fyre\\Schema\\SchemaRegistry;\r\n```\r\n\r\n\r\n## Basic Usage\r\n\r\n- `$container` is a [*Container*](https://github.com/elusivecodes/FyreContainer).\r\n\r\n```php\r\n$schemaRegistry = new SchemaRegistry($container);\r\n```\r\n\r\n**Autoloading**\r\n\r\nIt is recommended to bind the *SchemaRegistry* to the [*Container*](https://github.com/elusivecodes/FyreContainer) as a singleton.\r\n\r\n```php\r\n$container-\u003esingleton(SchemaRegistry::class);\r\n```\r\n\r\nAny dependencies will be injected automatically when loading from the [*Container*](https://github.com/elusivecodes/FyreContainer).\r\n\r\n```php\r\n$schemaRegistry = $container-\u003euse(SchemaRegistry::class);\r\n```\r\n\r\n\r\n## Methods\r\n\r\n**Map**\r\n\r\nMap a [*Connection*](https://github.com/elusivecodes/FyreDB#connections) class to a [*Schema*](#schemas) handler.\r\n\r\n- `$connectionClass` is a string representing the [*Connection*](https://github.com/elusivecodes/FyreDB#connections) class name.\r\n- `$schemaClass` is a string representing the [*Schema*](#schemas) class name.\r\n\r\n```php\r\n$schemaRegistry-\u003emap($connectionClass, $schemaClass);\r\n```\r\n\r\n**Use**\r\n\r\nLoad the shared [*Schema*](#schemas) for a [*Connection*](https://github.com/elusivecodes/FyreDB#connections).\r\n\r\n- `$connection` is a [*Connection*](https://github.com/elusivecodes/FyreDB#connections).\r\n\r\n```php\r\n$schema = $schemaRegistry-\u003euse($connection);\r\n```\r\n\r\n[*Schema*](#schemas) dependencies will be resolved automatically from the [*Container*](https://github.com/elusivecodes/FyreContainer).\r\n\r\n\r\n## Schemas\r\n\r\n**Clear**\r\n\r\nClear the table data (including cache).\r\n\r\n```php\r\n$schema-\u003eclear();\r\n```\r\n\r\n**Get Connection**\r\n\r\nGet the [*Connection*](https://github.com/elusivecodes/FyreDB#connections).\r\n\r\n```php\r\n$connection = $schema-\u003egetConnection();\r\n```\r\n\r\n**Get Database Name**\r\n\r\nGet the database name.\r\n\r\n```php\r\n$database = $schema-\u003egetDatabaseName();\r\n```\r\n\r\n**Has Table**\r\n\r\nDetermine whether the schema has a table.\r\n\r\n- `$name` is a string representing the table name.\r\n\r\n```php\r\n$hasTable = $schema-\u003ehasTable($name);\r\n```\r\n\r\n**Table**\r\n\r\nLoad a [*Table*](#tables).\r\n\r\n- `$name` is a string representing the table name.\r\n\r\n```php\r\n$table = $schema-\u003etable($name);\r\n```\r\n\r\n**Table Names**\r\n\r\nGet the names of all schema tables.\r\n\r\n```php\r\n$tableNames = $schema-\u003etableNames();\r\n```\r\n\r\n**Tables**\r\n\r\nLoad all schema tables.\r\n\r\n```php\r\n$tables = $schema-\u003etables();\r\n```\r\n\r\nThis method will return a [*Collection*](https://github.com/elusivecodes/FyreCollection) containing the loaded [tables](#tables).\r\n\r\n\r\n## Tables\r\n\r\n**Clear**\r\n\r\nClear the table data (including cache).\r\n\r\n```php\r\n$table-\u003eclear();\r\n```\r\n\r\n**Column**\r\n\r\nLoad a [*Column*](#columns).\r\n\r\n- `$name` is a string representing the column name.\r\n\r\n```php\r\n$column = $table-\u003ecolumn($name);\r\n```\r\n\r\n**Column Names**\r\n\r\nGet the names of all table columns.\r\n\r\n```php\r\n$columnNames = $table-\u003ecolumnNames();\r\n```\r\n\r\n**Columns**\r\n\r\nLoad all table columns.\r\n\r\n```php\r\n$columns = $table-\u003ecolumns();\r\n```\r\n\r\nThis method will return a [*Collection*](https://github.com/elusivecodes/FyreCollection) containing the loaded [columns](#columns).\r\n\r\n**Foreign Key**\r\n\r\nLoad a [*ForeignKey*](#foreign-keys).\r\n\r\n- `$name` is a string representing the foreign key name.\r\n\r\n```php\r\n$foreignKey = $table-\u003eforeignKey($name);\r\n```\r\n\r\n**Foreign Keys**\r\n\r\nLoad all table foreign keys.\r\n\r\n```php\r\n$foreignKeys = $table-\u003eforeignKeys();\r\n```\r\n\r\nThis method will return a [*Collection*](https://github.com/elusivecodes/FyreCollection) containing the loaded [foreign keys](#foreign-keys).\r\n\r\n**Get Comment**\r\n\r\nGet the table comment.\r\n\r\n```php\r\n$comment = $table-\u003egetComment();\r\n```\r\n\r\n**Get Name**\r\n\r\nGet the table name.\r\n\r\n```php\r\n$name = $table-\u003egetName();\r\n```\r\n\r\n**Get Schema**\r\n\r\nGet the [*Schema*](#schemas).\r\n\r\n```php\r\n$schema = $table-\u003egetSchema();\r\n```\r\n\r\n**Has Auto Increment**\r\n\r\nDetermine whether the table has an auto increment column.\r\n\r\n```php\r\n$hasAutoIncrement = $table-\u003ehasAutoIncrement();\r\n```\r\n\r\n**Has Column**\r\n\r\nDetermine whether the table has a column.\r\n\r\n- `$name` is a string representing the column name.\r\n\r\n```php\r\n$hasColumn = $table-\u003ehasColumn($name);\r\n```\r\n\r\n**Has Foreign Key**\r\n\r\nDetermine whether the table has a foreign key.\r\n\r\n- `$name` is a string representing the foreign key name.\r\n\r\n```php\r\n$hasForeignKey = $table-\u003ehasForeignKey($name);\r\n```\r\n\r\n**Has Index**\r\n\r\nDetermine whether the table has an index.\r\n\r\n- `$name` is a string representing the index name.\r\n\r\n```php\r\n$hasIndex = $table-\u003ehasIndex($name);\r\n```\r\n\r\n**Index**\r\n\r\nLoad an [*Index*](#indexes).\r\n\r\n- `$name` is a string representing the index name.\r\n\r\n```php\r\n$index = $table-\u003eindex($name);\r\n```\r\n\r\n**Indexes**\r\n\r\nLoad all table indexes.\r\n\r\n```php\r\n$indexes = $table-\u003eindexes();\r\n```\r\n\r\nThis method will return a [*Collection*](https://github.com/elusivecodes/FyreCollection) containing the loaded [indexes](#indexes).\r\n\r\n**Primary Key**\r\n\r\nGet the primary key for the table.\r\n\r\n```php\r\n$primaryKey = $table-\u003eprimaryKey();\r\n```\r\n\r\n**To Array**\r\n\r\nGet the table data as an array.\r\n\r\n```php\r\n$data = $table-\u003etoArray();\r\n```\r\n\r\n### Mysql Tables\r\n\r\n**Get Charset**\r\n\r\nGet the table character set.\r\n\r\n```php\r\n$charset = $table-\u003egetCharset();\r\n```\r\n\r\n**Get Collation**\r\n\r\nGet the table collation.\r\n\r\n```php\r\n$collation = $table-\u003egetCollation();\r\n```\r\n\r\n**Get Engine**\r\n\r\nGet the table engine.\r\n\r\n```php\r\n$engine = $table-\u003egetEngine();\r\n```\r\n\r\n\r\n## Columns\r\n\r\n**Default Value**\r\n\r\nGet the evaluated default value for a column.\r\n\r\n```php\r\n$defaultValue = $column-\u003edefaultValue();\r\n```\r\n\r\n**Get Comment**\r\n\r\nGet the column comment.\r\n\r\n```php\r\n$comment = $column-\u003egetComment();\r\n```\r\n\r\n**Get Default**\r\n\r\nGet the column default value.\r\n\r\n```php\r\n$default = $column-\u003egetDefault();\r\n```\r\n\r\n**Get Length**\r\n\r\nGet the column length.\r\n\r\n```php\r\n$length = $column-\u003egetLength();\r\n```\r\n\r\n**Get Name**\r\n\r\nGet the column name.\r\n\r\n```php\r\n$name = $column-\u003egetName();\r\n```\r\n\r\n**Get Precision**\r\n\r\nGet the column precision.\r\n\r\n```php\r\n$precision = $column-\u003egetPrecision();\r\n```\r\n\r\n**Get Table**\r\n\r\nGet the [*Table*](#tables).\r\n\r\n```php\r\n$table = $column-\u003egetTable();\r\n```\r\n\r\n**Get Type**\r\n\r\nGet the column type.\r\n\r\n```php\r\n$type = $column-\u003egetType();\r\n```\r\n\r\n**Is Auto Increment**\r\n\r\nDetermine whether the column is an auto increment column.\r\n\r\n```php\r\n$isAutoIncrement = $column-\u003eisAutoIncrement();\r\n```\r\n\r\n**Is Nullable**\r\n\r\nDetermine whether the column is nullable.\r\n\r\n```php\r\n$isNullable = $column-\u003eisNullable();\r\n```\r\n\r\n**Is Unsigned**\r\n\r\nDetermine whether the column is unsigned.\r\n\r\n```php\r\n$isUnsigned = $column-\u003eisUnsigned();\r\n```\r\n\r\n**To Array**\r\n\r\nGet the column data as an array.\r\n\r\n```php\r\n$data = $column-\u003etoArray();\r\n```\r\n\r\n**Type**\r\n\r\nGet the type parser for the column.\r\n\r\n```php\r\n$typeParser = $column-\u003etype();\r\n```\r\n\r\n### Mysql Columns\r\n\r\n**Get Charset**\r\n\r\nGet the column character set.\r\n\r\n```php\r\n$charset = $column-\u003egetCharset();\r\n```\r\n\r\n**Get Collation**\r\n\r\nGet the column collation.\r\n\r\n```php\r\n$collation = $column-\u003egetCollation();\r\n```\r\n\r\n**Get Values**\r\n\r\nGet the column enum values.\r\n\r\n```php\r\n$values = $column-\u003egetValues();\r\n```\r\n\r\n\r\n## Indexes\r\n\r\n**Get Columns**\r\n\r\nGet the column names.\r\n\r\n```php\r\n$columns = $index-\u003egetColumns();\r\n```\r\n\r\n**Get Name**\r\n\r\nGet the index name.\r\n\r\n```php\r\n$name = $index-\u003egetName();\r\n```\r\n\r\n**Get Table**\r\n\r\nGet the [*Table*](#tables).\r\n\r\n```php\r\n$table = $index-\u003egetTable();\r\n```\r\n\r\n**Get Type**\r\n\r\nGet the index type.\r\n\r\n```php\r\n$type = $index-\u003egetType();\r\n```\r\n\r\n**Is Primary**\r\n\r\nDetermine whether the index is primary.\r\n\r\n```php\r\n$isPrimary = $index-\u003eisPrimary();\r\n```\r\n\r\n**Is Unique**\r\n\r\nDetermine whether the index is unique.\r\n\r\n```php\r\n$isUnique = $index-\u003eisUnique();\r\n```\r\n\r\n**To Array**\r\n\r\nGet the index data as an array.\r\n\r\n```php\r\n$data = $index-\u003egetData();\r\n```\r\n\r\n\r\n## Foreign Keys\r\n\r\n**Get Columns**\r\n\r\nGet the column names.\r\n\r\n```php\r\n$columns = $foreignKey-\u003egetColumns();\r\n```\r\n\r\n**Get Name**\r\n\r\nGet the foreign key name.\r\n\r\n```php\r\n$name = $foreignKey-\u003egetName();\r\n```\r\n\r\n**Get On Delete**\r\n\r\nGet the delete action.\r\n\r\n```php\r\n$onDelete = $foreignKey-\u003egetOnDelete();\r\n```\r\n\r\n**Get On Update**\r\n\r\nGet the update action.\r\n\r\n```php\r\n$onUpdate = $foreignKey-\u003egetOnUpdate();\r\n```\r\n\r\n**Get Referenced Columns**\r\n\r\nGet the referenced column names.\r\n\r\n```php\r\n$referencedColumn = $foreignKey-\u003egetReferencedColumns();\r\n```\r\n\r\n**Get Referenced Table**\r\n\r\nGet the referenced table name.\r\n\r\n```php\r\n$referencedTable = $foreignKey-\u003egetReferencesTable();\r\n```\r\n\r\n**Get Table**\r\n\r\nGet the [*Table*](#tables).\r\n\r\n```php\r\n$table = $foreignKey-\u003egetTable();\r\n```\r\n\r\n**To Array**\r\n\r\nGet the foreign key data as an array.\r\n\r\n```php\r\n$data = $foreignKey-\u003etoArray();\r\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyreschema","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felusivecodes%2Ffyreschema","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felusivecodes%2Ffyreschema/lists"}