GithubHelp home page GithubHelp logo

elusivecodes / fyreschema Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 110 KB

FyreSchema is a free, open-source database schema library for PHP.

License: MIT License

PHP 100.00%
php database schema mysql postgreql sqlite

fyreschema's Introduction

FyreSchema

FyreSchema is a free, open-source database schema library for PHP.

Table Of Contents

Installation

Using Composer

composer require fyre/schema

In PHP:

use Fyre\Schema\SchemaRegistry;

Schema Registry

Get Cache

Get the Cacher.

$cache = SchemaRegistry::getCache();

Get Schema

Get the Schema for a Connection.

$schema = SchemaRegistry::getSchema($connection);

Set Cache

Set the Cacher.

SchemaRegistry::getCache($cache);

Set Handler

Set a Schema handler for a Connection class.

  • $connectionClass is a string representing the Connection class name.
  • $schemaClass is a string representing the Schema class name.
SchemaRegistry::setHandler($connectionClass, $schemaClass);

Schemas

Clear

Clear data from the cache.

$schema->clear();

Describe

Get the TableSchema for a table.

  • $name is a string representing the table name.
$tableSchema = $schema->describe($name);

Get Connection

Get the Connection.

$connection = $schema->getConnection();

Get Database Name

Get the database name.

$database = $schema->getDatabaseName();

Has Table

Determine if the schema has a table.

  • $name is a string representing the table name.
$hasTable = $schema->hasTable($name);

Table

Get the data for a table.

  • $name is a string representing the table name.
$table = $schema->table($name);

Table Names

Get the names of all schema tables.

$tableNames = $schema->tableNames();

Tables

Get the data for all schema tables.

$tables = $schema->tables();

Table Schemas

Clear

Clear data from the cache.

$tableSchema->clear();

Column

Get the data for a table column.

  • $name is a string representing the column name.
$column = $tableSchema->column($name);

Column Names

Get the names of all table columns.

$columnNames = $tableSchema->columnNames();

Columns

Get the data for all table columns.

$columns = $tableSchema->columns();

Default Value

Get the default value for a column.

  • $name is a string representing the column name.
$defaultValue = $tableSchema->defaultValue($name);

This method will evaluate expression values (eg. current_timestamp()).

Foreign Key

Get the data for a table foreign key.

  • $name is a string representing the foreign key name.
$foreignKey = $tableSchema->foreignKey($name);

Foreign Keys

Get the data for all table foreign keys.

$foreignKeys = $tableSchema->foreignKeys();

Get Schema

Get the Schema.

$schema = $tableSchema->getSchema();

Get Table Name

Get the table name.

$tableName = $tableSchema->getTableName();

Get Type

Get the Type parser for a column.

  • $name is a string representing the column name.
$parser = $tableSchema->getType($name);

Has Auto Increment

Determine if the table has an auto increment column.

$hasAutoIncrement = $tableSchema->hasAutoIncrement();

Has Column

Determine if the table has a column.

  • $name is a string representing the column name.
$hasColumn = $tableSchema->hasColumn($name);

Has Foreign Key

Determine if the table has a foreign key.

  • $name is a string representing the foreign key name.
$hasForeignKey = $tableSchema->hasForeignKey($name);

Has Index

Determine if the table has an index.

  • $name is a string representing the index name.
$hasIndex = $tableSchema->hasIndex($name);

Index

Get the data for a table index.

  • $name is a string representing the index name.
$index = $tableSchema->index($name);

Indexes

Get the data for all table indexes.

$indexes = $tableSchema->indexes();

Is Nullable

Determine if a table column is nullable.

  • $name is a string representing the column name.
$isNullable = $tableSchema->isNullable($name);

Primary Key

Get the primary key for the table.

$primaryKey = $tableSchema->primaryKey();

fyreschema's People

Contributors

elusivecodes avatar pm-michael avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.