Download the PHP package simba-jirira-source/laravel-schema-contract without Composer

On this page you can find all versions of the php package simba-jirira-source/laravel-schema-contract. 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 laravel-schema-contract

Laravel Schema Contract

Detect inconsistencies between Laravel database schema metadata and Eloquent model casts.

Packagist PHP from Packagist Laravel versions GitHub Workflow Status (main) Total Downloads

Purpose

Laravel Schema Contract is developer tooling for Laravel applications. It answers a focused question for v0.1.x:

Do my database columns and Eloquent model casts describe compatible data types?

The package discovers Eloquent models, reads live schema metadata from each model's effective connection and table, normalizes database and cast types, and reports contract violations with CI-friendly exit codes.

v0.1.x scope: Database Schema ↔ Eloquent Model only.

The analyzer is read-only. It never mutates schema, models, or application data.

Requirements

Installation

Install the package as a development dependency:

Laravel auto-discovery registers the service provider and Artisan command.

Publish the configuration file when you need custom discovery or ignore rules:

Quick start

  1. Ensure your application database schema is migrated.
  2. Run the check against all discovered models:

  3. Fix reported ERROR rows before merging. Treat WARNING rows as recommended improvements; they do not fail CI by default.

Analyze one model:

Short class names work when they resolve to exactly one discovered model.

Example output

Given a users table with a boolean active column, a decimal credit_limit, and a JSON preferences column, and a model that casts credit_limit to integer while leaving preferences uncast:

Severity meanings:

Severity Meaning Fails CI by default
ERROR High-confidence incompatible contract Yes (exit code 1)
WARNING Suspicious or recommended improvement No
INFO Non-blocking information No

Commands

Command Description
php artisan schema-contract:check Analyze all discovered Eloquent models
php artisan schema-contract:check {model} Analyze one model by FQCN or short name

Exit codes

Code Meaning
0 No blocking contract errors (warnings allowed)
1 One or more contract errors detected
2 Configuration, resolution, or runtime failure

Examples of exit code 2: unresolvable model argument, ambiguous short class name, missing database table for a targeted model.

When no models are discovered, the command exits 0 and prints a warning.

Configuration

Configuration lives in config/schema-contract.php after publishing.

Option Purpose
model_paths Directories searched recursively for concrete Eloquent models. Falls back to app_path('Models') when empty.
ignore_models Fully-qualified model classes excluded from bulk discovery and default checks. Targeted analysis by FQCN still works.
ignore_columns Table-specific columns skipped during rule checks. Keys are database table names.

Supported databases and types

Database drivers

Driver Support in v0.1.x CI verification
SQLite First-class Default test suite
MySQL / MariaDB First-class database-compatibility workflow
PostgreSQL First-class database-compatibility workflow

See docs/DATABASE_SUPPORT.md for driver-specific metadata behavior, verified type mappings, and known limitations.

Normalized database types

The package maps raw driver metadata to internal database types:

boolean, integer, big_integer, small_integer, decimal, float, double, string, text, date, datetime, timestamp, json, uuid, enum, binary, unknown

Unknown or incomplete metadata maps to unknown and produces conservative warnings rather than crashing analysis.

Normalized cast types

Built-in and class-based casts normalize to:

boolean, integer, float, double, decimal, string, array, object, collection, date, datetime, timestamp, enum, custom, unknown

Custom cast classes are recognized without being misclassified as enums. Expressions such as decimal:2 retain scale metadata.

Contract rules (v0.1.x)

CI usage

Add the check to your pipeline after migrations are available (or against a migrated test database):

The command exits 1 when contract errors exist, so a failing step blocks the pipeline without extra flags.

Warnings alone do not fail the command.

This repository validates the package itself with GitHub Actions:

Workflow Purpose
tests.yml PHP 8.3/8.4/8.5 matrix, Composer validate, PHPStan, Pint, type coverage, Pest
database-compatibility.yml MySQL and PostgreSQL grouped integration tests

Forks and consuming applications can mirror the same quality commands during development:

Limitations

Not implemented in v0.1.x (planned for later releases):

Current analysis limits:

Roadmap

Version Focus
v0.1 Database ↔ Eloquent
v0.2 Database ↔ Validation
v0.3 Enums, defaults, nullability
v0.4 Model ↔ FormRequest
v0.5 API Resource contracts
v0.6 Livewire contracts
v0.7 CI / JSON / GitHub reporting
v0.8 Baselines / suppression
v0.9 Public extension API
v1.0 Stable public API

Each release is intended to be independently useful. See the product specification for the full scope and roadmap.

Testing

Package development

Clone the repository and install dependencies:

Run the full quality suite:

Individual commands:

composer test runs the release gate with serial Pest for reliable Testbench bootstrapping.

Driver integration tests

SQLite tests run in the default suite. MySQL and PostgreSQL grouped tests require environment configuration. See docs/DATABASE_SUPPORT.md.

Contributing

Please see CONTRIBUTING.md. For significant changes, open an issue first.

Security

The analyzer may include model names, table names, column names, and type metadata in output. It does not dump application records.

Please review SECURITY.md for vulnerability reporting.

License

Laravel Schema Contract is open-source software licensed under the MIT license.

Changelog

Please see CHANGELOG.md for release notes.


All versions of laravel-schema-contract with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
illuminate/console Version ^13.0
illuminate/database Version ^13.0
illuminate/support Version ^13.0
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 simba-jirira-source/laravel-schema-contract contains the following files

Loading the files please wait ...