Download the PHP package georgeff/schema without Composer

On this page you can find all versions of the php package georgeff/schema. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package schema

georgeff/schema

Database schema builder for PHP. Define table structures using a fluent blueprint API and compile them to SQL for MySQL, PostgreSQL, or SQLite. Produces raw SQL strings — no connection required.

Installation

Overview

georgeff/schema separates schema definition from execution. You build a Blueprint, pass it to a compiler, and receive an array of SQL strings to run however you like.

Compilers

Three compilers are available, each implementing CompilerInterface:

Both MySQLCompiler and PostgreSQLCompiler accept optional constructor arguments:

Compiler Methods

create(Blueprint $blueprint): string[]

Returns one or more SQL statements to create the table. MySQL always returns a single statement with indexes inline. PostgreSQL and SQLite return additional CREATE INDEX statements when non-primary indexes are present.

drop(string $table, bool $ifExists = false): string

tableExists(): string

Returns a parameterized SQL query that checks whether a table exists. Pass the table name as a bound parameter when executing — do not interpolate it directly.

The query shape varies by driver:

alter(Blueprint $blueprint): string[]

Returns one statement per change. Used for adding/dropping columns, indexes, and foreign keys on an existing table.

SQLite limitation: SQLite only supports ADD COLUMN and DROP COLUMN. Calls to dropIndex(), dropForeign(), and foreign() on a Blueprint passed to SQLiteCompiler::alter() are silently ignored.

Blueprint

Column Types

Method Description
id(string $name = 'id') BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY
bigInteger(string $name) 8-byte integer
integer(string $name) 4-byte integer
smallInteger(string $name) 2-byte integer
tinyInteger(string $name) 1-byte integer (MySQL) / SMALLINT (PostgreSQL)
float(string $name) Floating point
decimal(string $name, int $precision = 8, int $scale = 2) Fixed precision
string(string $name, int $length = 255) VARCHAR
char(string $name, int $length = 1) Fixed-length string
text(string $name) Unbounded text
boolean(string $name) Boolean (TINYINT(1) on MySQL, BOOLEAN on PostgreSQL, INTEGER on SQLite)
json(string $name) JSON (TEXT on SQLite)
uuid(string $name) UUID (CHAR(36) on MySQL, UUID on PostgreSQL, TEXT on SQLite)
date(string $name) Date
time(string $name) Time
timestamp(string $name) Timestamp (TEXT on SQLite)
timestamps() Adds nullable created_at and updated_at timestamp columns

Column Modifiers

Modifiers chain off any column factory method:

defaultRaw() emits the provided string directly into the DDL without quoting — use it for SQL functions and expressions:

Warning: defaultRaw() must never be called with user-supplied input. It is intended for developer-authored migration files only.

Modifier Description
nullable(bool $value = true) Allows NULL; pass false to revert
unsigned() UNSIGNED (MySQL only; ignored on PostgreSQL and SQLite)
default(mixed $value) Sets a default value
defaultRaw(string $sql) Sets a raw SQL expression as the default — emitted unquoted
incrementing() AUTO_INCREMENT (MySQL) / SERIAL/BIGSERIAL (PostgreSQL) / AUTOINCREMENT (SQLite)
primary(?string $name = null) Marks column as primary key
unique(?string $name = null) Adds a unique index
index(?string $name = null) Adds a regular index

Foreign Keys

An optional constraint name can be passed as the second argument to foreign():

Valid actions for onDelete and onUpdate: NO ACTION, RESTRICT, SET NULL, CASCADE. Both default to RESTRICT.

ALTER Operations

Index Naming

When no name is provided, indexes are auto-named using the pattern:

Where suffix is primary, unique, index, or foreign. For example:

Pass an explicit name to override:

Driver Differences

Feature MySQL PostgreSQL SQLite
Quoting Backticks Double quotes Double quotes
Auto-increment AUTO_INCREMENT SERIAL / BIGSERIAL INTEGER PRIMARY KEY AUTOINCREMENT
Unsigned columns Supported Silently ignored Silently ignored
Boolean TINYINT(1) BOOLEAN INTEGER
UUID CHAR(36) UUID TEXT
Indexes in CREATE TABLE Inline Separate statements Separate statements
ALTER foreign key support Yes Yes No
tableExists source information_schema + DATABASE() information_schema + configured schema sqlite_master

All versions of schema with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package georgeff/schema contains the following files

Loading the files please wait ...