Download the PHP package tusharkhan/db-error-explainer-core without Composer

On this page you can find all versions of the php package tusharkhan/db-error-explainer-core. 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 db-error-explainer-core

DB Error Explainer Core

Latest Version Downloads

Framework-agnostic PHP library that explains database exceptions in plain language and suggests a fix. Works with any PDO connection to MySQL / MariaDB, PostgreSQL or SQLite.

For Laravel, use tusharkhan/db-error-explainer-laravel, which wires this up for you.

Requirements

Installation

Usage

explain() never throws. If analysis itself fails you get a diagnosis with errorType analysis_failed and the original message.

The database is detected from the PDO connection (PDO::ATTR_DRIVER_NAME). When there is no working connection, for example because connecting failed, pass null and name the driver:

The diagnosis

Property Example
errorType fk_missing_parent, the rule id, shared across databases
errorCode 1452 on MySQL, the SQLSTATE (23503) on PostgreSQL, 19 on SQLite
sqlState 23000
explanation Plain-language explanation with your table / column names
migrationSuggestion['migration_suggestion'] SQL fix, or ''
migrationSuggestion['other_suggestions'] Tip (often Laravel-specific), or ''
context Extracted names and, with introspection, table_exists, table_columns, foreign_keys, unique_constraints, column_type
originalMessage The database's message
metadata rule_id (none when no rule matched), driver, introspection_enabled, timestamp

Output helpers: format() (readable text), toArray(), toJson().

Options

Introspection only runs read-only queries (information_schema, pg_catalog or SQLite PRAGMAs). Turn it off if you don't want the extra queries, e.g. 'allow_introspection' => getenv('APP_ENV') !== 'production'.

Custom rules

Rules are arrays, checked after the built-in ones for the active database:

Adding a database

Implement TusharKhan\DbErrorExplainer\Drivers\DriverInterface (rules, message parser, introspector, error descriptions) and pass an instance as the driver option. The built-in drivers in src/Drivers/ are the reference.

License

MIT. See LICENSE.


All versions of db-error-explainer-core with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
ext-pdo Version *
psr/log Version ^3.0
tusharkhan/db-error-explainer-lib Version ^1.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 tusharkhan/db-error-explainer-core contains the following files

Loading the files please wait ...