Download the PHP package hectororm/schema without Composer
On this page you can find all versions of the php package hectororm/schema. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hectororm/schema
More information about hectororm/schema
Files in hectororm/schema
Package schema
Short Description Hector Schema
License MIT
Homepage https://gethectororm.com
Informations about the package schema
Hector Schema
Hector Schema is the schema generator module of Hector ORM. Can be used independently of ORM.
Installation
Composer
You can install Hector Schema with Composer, it's the recommended installation.
Dependencies
- PHP ^8.0
- Packages dependencies:
- hectororm/connection
DBMS compatibility
DBMS | Version | Compatibility |
---|---|---|
MySQL | 8.0 | ✔ |
MySQL | 5.7 | ✔ |
MySQL | 5.6 | ✔ |
MySQL | 5.5 | ? |
MariaDB | 10.6 | ✔ |
MariaDB | 10.5 | ✔ |
MariaDB | 10.4 | ✔ |
MariaDB | 10.3 | ✔ |
MariaDB | 10.2 | ? |
Sqlite | 3.x | ✔ |
If you have any information on the compatibility of other versions, feel free to make a PR.
Usage
Generate a schema
Generators:
Hector\Schema\Generato\MySQL
for MySQL or derived DBMSHector\Schema\Generato\Sqlite
for Sqlite
Cache
This library don't provide cache management for schemas. It's to the user library to imagine how store the generated schema.
To help to do that, library only provide serialization of objects and restoration of inheritance between objects.
Schema
Description of classes represents the a schema.
Hector\Schema\SchemaContainer
It's a container of schema. Methods available:
SchemaContainer::getSchemas(?string $connection = null): Generator
Returns a generator ofHector\Schema\Schema
objects, you can pass a specific connectionSchemaContainer::hasSchema(string $name, ?string $connection = null): bool
Check if container has a schemaSchemaContainer::getSchema(string $name, ?string $connection = null): Schema
Returns representation of a schema, anHector\Schema\Schema
objectSchemaContainer::hasTable(string $name, ?string $schemaName = null, ?string $connection = null): bool
Check if a schema in the container has a tableSchemaContainer::getTable(string $name, ?string $schemaName = null, ?string $connection = null): Table
Returns representation of a table, anHector\Schema\Table
object
It's an iterable class, returns Hector\Schema\Schema
objects.
Hector\Schema\Schema
Represent a schema. Methods available:
Schema::getName(bool $quoted = false): string
Returns the name of schemaSchema::getCharset(): string
Returns the charset of schemaSchema::getCollation(): string
Returns the charset of schemaSchema::getTables(): Generator
Returns a generator ofHector\Schema\Table
objectsSchema::hasTable(string $name): bool
Check if schema has a tableSchema::getTable(string $name): Table
Returns representation of a table, anHector\Schema\Table
objectSchema::getContainer(): ?SchemaContainer
Returns the container of schema if it's a part of a container
It's an iterable class, returns Hector\Schema\Table
objects.
Hector\Schema\Table
Represent a table of a schema. Methods available:
Table::getSchemaName(bool $quoted = false): string
Table::getName(bool $quoted = false): string
Table::getFullName(bool $quoted = false): string
Table::getType(): string
Table::getCharset(): ?string
Table::getCollation(): ?string
Table::getColumns(): Generator
Table::getColumnsName(bool $quoted = false, ?string $tableAlias = null): array
Table::hasColumn(string $name): bool
Table::getColumn(string $name): Column
Table::getAutoIncrementColumn(): ?Column
Table::getIndexes(?string $type = null): Generator
Table::hasIndex(string $name): bool
Table::getIndex(string $name): Index
Table::getPrimaryIndex(): ?Index
Table::getForeignKeys(Table $table = null): Generator
Table::getSchema(): Schema
Hector\Schema\Column
Represent a column of a table. Methods available:
Column::getName(bool $quoted = false, ?string $tableAlias = null): string
Column::getFullName(bool $quoted = false): string
Column::getPosition(): int
Column::getDefault(): mixed
Column::isNullable(): bool
Column::getType(): string
Column::isAutoIncrement(): bool
Column::getMaxlength(): ?int
Column::getNumericPrecision(): ?int
Column::getNumericScale(): ?int
Column::isUnsigned(): bool
Column::getCharset(): ?string
Column::getCollation(): ?string
Column::getTable(): Table
Column::isPrimary(): bool
Hector\Schema\Index
Represent an index of a table. Methods available:
Index::getName(): string
Index::getType(): string
Index::getColumnsName(bool $quoted = false, ?string $tableAlias = null): array
Index::getTable(): Table
Index::getColumns(): array
Index::hasColumn(Column $column): bool
Hector\Schema\ForeignKey
Represent a foreign key of a table. Methods available:
ForeignKey::getName(): string
ForeignKey::getColumnsName(bool $quoted = false, ?string $tableAlias = null): array
ForeignKey::getReferencedSchemaName(): string
ForeignKey::getReferencedTableName(): string
ForeignKey::getReferencedColumnsName(bool $quoted = false, ?string $tableAlias = null): array
ForeignKey::getUpdateRule(): string
ForeignKey::getDeleteRule(): string
ForeignKey::getTable(): Table
ForeignKey::getColumns(): Generator
ForeignKey::getReferencedTable(): ?Table
ForeignKey::getReferencedColumns(): Generator