Download the PHP package fyre/forge without Composer
On this page you can find all versions of the php package fyre/forge. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package forge
FyreForge
FyreForge is a free, open-source database forge library for PHP.
Table Of Contents
- Installation
- Forge Registry
- Forges
- MySQL
- Postgres
- Sqlite
- Table Forges
Installation
Using Composer
In PHP:
Forge Registry
Get Forge
Get the Connection.
$connection
is a Connection.
Set Handler
Set a Connection class.
$connectionClass
is a string representing the Connection class name.$forgeClass
is a string representing the Forge class name.
Forges
Add Column
Add a column to a table.
$table
is a string representing the table name.$column
is a string representing the column name.$options
is an array containing the column options.type
is a string representing the column type, and will default to "varchar".length
is a number representing the column length, and will default to the type default.precision
is a number representing the column precision, and will default to the type default.nullable
is a boolean indicating whether the column is nullable, and will default to false.default
is a string representing the column default value, and will default to null (no default).autoIncrement
is a boolean indicating whether the column is an an auto incrementing column, and will default to false.
Additional column options may be available depending on the connection handler.
Add Index
Add an index to a table.
$table
is a string representing the table name.$index
is a string representing the index name.$options
is an array containing the index options.columns
is a string or array containing the columns to use for the index, and will default to the index name.unique
is a boolean indicating whether the index must be unique, and will default to false.primary
is a boolean indicating whether the index is a primary key, and will default to false.
Additional index options may be available depending on the connection handler.
Build
Build a TableForge.
$table
is a string representing the table name.
Additional table options may be available depending on the connection handler.
Create Table
Create a new table.
$table
is a string representing the table name.$columns
is an array containing the column definitions.$options
is an array containing the schema options.indexes
is an array containing the index definitions.foreignKeys
is an array containing the foreign key definitions.ifNotExists
is a boolean indicating whether to use anIF NOT EXISTS
clause, and will default to false.
Additional table options may be available depending on the connection handler.
Drop Column
Drop a column from a table.
$table
is a string representing the table name.$column
is a string representing the column name.$options
is an array containing the column options.ifExists
is a boolean indicating whether to use anIF EXISTS
clause, and will default to false.
Drop Index
Drop an index from a table.
$table
is a string representing the table name.$index
is a string representing the index name.
Drop Table
Drop a table.
$table
is a string representing the table name.$options
is an array containing the table options.ifExists
is a boolean indicating whether to use anIF EXISTS
clause, and will default to false.
Get Connection
Get the Connection.
Rename Column
Rename a column.
$table
is a string representing the table name.$column
is a string representing the column name.$newColumn
is a string representing the new column name.
Rename Table
Rename a table.
$table
is a string representing the table name.$newTable
is a string representing the new table name.
MySQL
The MySQL Forge extends the Forge class and provides additional methods and options specific to MySQL databases.
Add Column
Add a column to a table.
$table
is a string representing the table name.$column
is a string representing the column name.$options
is an array containing the column options.type
is a string representing the column type, and will default to "varchar".length
is a number representing the column length, and will default to the type default.precision
is a number representing the column precision, and will default to the type default.values
is an array containing the enum/set values, and will default to null.nullable
is a boolean indicating whether the column is nullable, and will default to false.unsigned
is a boolean indicating whether the column is unsigned, and will default to false.default
is a string representing the column default value, and will default to null (no default).charset
is a string representing the column character set, and will default to the connection character set.collation
is a string representing the column collation, and will default to the connection collation.autoIncrement
is a boolean indicating whether the column is an an auto incrementing column, and will default to false.comment
is a string representing the column comment, and will default to "".after
is a string representing the column to add this column after, and will default to null.first
is a boolean indicating whether to add this column first in the table, and will default to false.
Add Foreign Key
Add a foreign key to a table.
$table
is a string representing the table name.$foreignKey
is a string representing the foreign key name.$options
is an array containing the foreign key options.columns
is a string or array containing the columns to use for the foreign key, and will default to the foreign key name.referencedTable
is a string representing the referenced table to use.referencedColumns
is a string or array containing the columns to use in the referenced table.update
is a string containing the ON UPDATE operation, and will default to "".delete
is a string containing the ON DELETE operation, and will default to "".
Add Index
Add an index to a table.
$table
is a string representing the table name.$index
is a string representing the index name.$options
is an array containing the index options.columns
is a string or array containing the columns to use for the index, and will default to the index name.type
is a string representing the index type, and will default to "BTREE".unique
is a boolean indicating whether the index must be unique, and will default to false.primary
is a boolean indicating whether the index is a primary key, and will default to false.
Alter Table
Alter a table.
$table
is a string representing the table name.$options
is an array containing the table options.engine
is a string representing the table engine, and will default to "InnoDB".charset
is a string representing the table character set, and will default to the connection character set.collation
is a string representing the table collation, and will default to the connection collation.comment
is a string representing the table comment, and will default to "".
Build
Build a TableForge.
$table
is a string representing the table name.$options
is an array containing the table options.engine
is a string representing the table engine, and will default to "InnoDB".charset
is a string representing the table character set, and will default to the connection character set.collation
is a string representing the table collation, and will default to the connection collation.comment
is a string representing the table comment, and will default to "".
Change Column
Change a table column.
$table
is a string representing the table name.$column
is a string representing the column name.$options
is an array containing the column options.name
is a string representing the new column name, and will default to the column name.type
is a string representing the column type, and will default to "varchar".length
is a number representing the column length, and will default to the type default.precision
is a number representing the column precision, and will default to the type default.values
is an array containing the enum/set values, and will default to null.nullable
is a boolean indicating whether the column is nullable, and will default to false.unsigned
is a boolean indicating whether the column is unsigned, and will default to false.default
is a string representing the column default value, and will default to null (no default).charset
is a string representing the column character set, and will default to the connection character set.collation
is a string representing the column collation, and will default to the connection collation.autoIncrement
is a boolean indicating whether the column is an an auto incrementing column, and will default to false.comment
is a string representing the column comment, and will default to "".after
is a string representing the column to add this column after, and will default to null.first
is a boolean indicating whether to add this column first in the table, and will default to false.
Create Schema
Create a new schema.
$schema
is a string representing the schema name.$options
is an array containing the schema options.charset
is a string representing the schema character set, and will default to the connection character set.collation
is a string representing the schema collation, and will default to the connection collation.ifNotExists
is a boolean indicating whether to use anIF NOT EXISTS
clause, and will default to false.
Create Table
Create a new table.
$table
is a string representing the table name.$columns
is an array containing the column definitions.$options
is an array containing the schema options.indexes
is an array containing the index definitions.foreignKeys
is an array containing the foreign key definitions.engine
is a string representing the table engine, and will default to "InnoDB".charset
is a string representing the table character set, and will default to the connection character set.collation
is a string representing the table collation, and will default to the connection collation.comment
is a string representing the table comment, and will default to "".ifNotExists
is a boolean indicating whether to use anIF NOT EXISTS
clause, and will default to false.
Drop Foreign Key
Drop a foreign key from a table.
$table
is a string representing the table name.$foreignKey
is a string representing the foreign key name.
Drop Primary Key
Drop a primary key from a table.
$table
is a string representing the table name.
Drop Schema
Drop a schema.
$schema
is a string representing the schema name.$options
is an array containing the schema options.ifExists
is a boolean indicating whether to use anIF EXISTS
clause, and will default to false.
Postgres
The Postgres Forge extends the Forge class and provides additional methods and options specific to Postgres databases.
Add Column
Add a column to a table.
$table
is a string representing the table name.$column
is a string representing the column name.$options
is an array containing the column options.type
is a string representing the column type, and will default to "varchar".length
is a number representing the column length, and will default to the type default.precision
is a number representing the column precision, and will default to the type default.nullable
is a boolean indicating whether the column is nullable, and will default to false.default
is a string representing the column default value, and will default to null (no default).autoIncrement
is a boolean indicating whether the column is an an auto incrementing column, and will default to false.comment
is a string representing the column comment, and will default to "".
Add Foreign Key
Add a foreign key to a table.
$table
is a string representing the table name.$foreignKey
is a string representing the foreign key name.$options
is an array containing the foreign key options.columns
is a string or array containing the columns to use for the foreign key, and will default to the foreign key name.referencedTable
is a string representing the referenced table to use.referencedColumns
is a string or array containing the columns to use in the referenced table.update
is a string containing the ON UPDATE operation, and will default to "".delete
is a string containing the ON DELETE operation, and will default to "".
Alter Column Auto Increment
Alter a column's auto increment.
$table
is a string representing the table name.$column
is a string representing the column name.$autoIncrement
is a boolean indicating whether the column is an an auto incrementing column.
Alter Column Default
Alter a column's default value.
$table
is a string representing the table name.$column
is a string representing the column name.$default
is a string representing the column default value.
Alter Column Nullable
Alter whether a column is nullable.
$table
is a string representing the table name.$column
is a string representing the column name.$nullable
is a boolean indicating whether the column is nullable, and will default to false.
Alter Column Type
Alter a column's type.
$table
is a string representing the table name.$column
is a string representing the column name.$options
is an array containing the column options.type
is a string representing the column type, and will default to "varchar".length
is a number representing the column length, and will default to the type default.precision
is a number representing the column precision, and will default to the type default.
Build
Build a TableForge.
$table
is a string representing the table name.$options
is an array containing the table options.comment
is a string representing the table comment, and will default to "".
Comment On Column
Set the comment for a column.
$table
is a string representing the table name.$column
is a string representing the column name.$comment
is a string representing the table comment.
Comment On Table
Set the comment for a table.
$table
is a string representing the table name.$comment
is a string representing the table comment.
Create Schema
Create a new schema.
$schema
is a string representing the schema name.$options
is an array containing the schema options.ifNotExists
is a boolean indicating whether to use anIF NOT EXISTS
clause, and will default to false.
Create Table
Create a new table.
$table
is a string representing the table name.$columns
is an array containing the column definitions.$options
is an array containing the schema options.indexes
is an array containing the index definitions.foreignKeys
is an array containing the foreign key definitions.comment
is a string representing the table comment, and will default to "".ifNotExists
is a boolean indicating whether to use anIF NOT EXISTS
clause, and will default to false.
Drop Constraint
Drop a constraint from a table.
$table
is a string representing the table name.$index
is a string representing the index name.
Drop Foreign Key
Drop a foreign key from a table.
$table
is a string representing the table name.$foreignKey
is a string representing the foreign key name.
Drop Primary Key
Drop a primary key from a table.
$table
is a string representing the table name.
Drop Schema
Drop a schema.
$schema
is a string representing the schema name.$options
is an array containing the schema options.ifExists
is a boolean indicating whether to use anIF EXISTS
clause, and will default to false.
Sqlite
The Sqlite Forge extends the Forge class.
Table Forges
Add Column
Add a column to the table.
$column
is a string representing the column name.$options
is an array containing the column options.name
is a string representing the new column name, and will default to the column name.type
is a string representing the column type, and will default to "varchar".length
is a number representing the column length, and will default to the type default.precision
is a number representing the column precision, and will default to the type default.nullable
is a boolean indicating whether the column is nullable, and will default to false.default
is a string representing the column default value, and will default to null (no default).autoIncrement
is a boolean indicating whether the column is an an auto incrementing column, and will default to false.
Additional column options may be available depending on the connection handler.
Add Foreign Key
Add a foreign key to the table.
$foreignKey
is a string representing the foreign key name.$options
is an array containing the foreign key options.columns
is a string or array containing the columns to use for the foreign key, and will default to the foreign key name.referencedTable
is a string representing the referenced table to use.referencedColumns
is a string or array containing the columns to use in the referenced table.update
is a string containing the ON UPDATE operation, and will default to "".delete
is a string containing the ON DELETE operation, and will default to "".
Foreign keys cannot be added to an existing Sqlite table.
Add Index
Add an index to the table.
$index
is a string representing the index name.$options
is an array containing the index options.columns
is a string or array containing the columns to use for the index, and will default to the index name.unique
is a boolean indicating whether the index must be unique, and will default to false.primary
is a boolean indicating whether the index is a primary key, and will default to false.
Additional index options may be available depending on the connection handler.
Primary keys cannot be added to an existing Sqlite table.
Change Column
Change a table column.
$column
is a string representing the column name.$options
is an array containing the column options.name
is a string representing the new column name, and will default to the column name.
Additional column options may be available depending on the connection handler.
Column definitions can not be modified for an existing Sqlite table.
Clear
Clear the column and index data.
Column
Get the data for a table column.
$name
is a string representing the column name.
Column Names
Get the names of all table columns.
Columns
Get the data for all table columns.
Drop
Drop the table.
Drop Column
Drop a column from the table.
$column
is a string representing the column name.
Drop Foreign Key
Drop a foreign key from the table.
$foreignKey
is a string representing the foreign key name.
Foreign keys cannot be dropped from an existing Sqlite table.
Drop Index
Drop an index from the table.
$index
is a string representing the index name.
Primary and unique keys cannot be dropped from an existing Sqlite table.
Execute
Generate and execute the SQL queries.
Foreign Key
Get the data for a table foreign key.
$name
is a string representing the foreign key name.
Foreign Keys
Get the data for all table foreign keys.
Get Forge
Get the Forge.
Get Table Name
Get the table name.
Has Column
Determine if the table has a column.
$name
is a string representing the column name.
Has Foreign Key
Determine if the table has a foreign key.
$name
is a string representing the foreign key name.
Has Index
Determine if the table has an index.
$name
is a string representing the index name.
Index
Get the data for a table index.
$name
is a string representing the index name.
Indexes
Get the data for all table indexes.
Rename
Rename the table.
$table
is a string representing the new table name.
Set Primary Key
Set the primary key.
$columns
is a string or array containing the columns to use for the primary key.
Primary keys cannot be added to an existing Sqlite table.
SQL
Generate the SQL queries.