Download the PHP package vicgutt/laravel-inspect-db without Composer
On this page you can find all versions of the php package vicgutt/laravel-inspect-db. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vicgutt/laravel-inspect-db
More information about vicgutt/laravel-inspect-db
Files in vicgutt/laravel-inspect-db
Package laravel-inspect-db
Short Description Inspect and retrieve information about a given database
License MIT
Homepage https://github.com/vicgutt/laravel-inspect-db
Informations about the package laravel-inspect-db
Inspect and retrieve information about a given database
This package allows you to inspect and retrieve information about your databases. This package has been tested against Sqlite, MySQL and PostgreSQL although others might work as well, if not, let's discuss it.
Here's a quick example:
Installation
You can install the package via composer:
You can publish the config file with:
You can check out what the contents of the published config file will be here: config/inspect-db.php
Inspect
The VicGutt\InspectDb\Inspect
class is the main entry point of the package. It allows you to retrieve information about tables, a table's columns, it's indexes and foreign keys.
Retrieving the tables of a given database connection
Here, as no database connection was specified, the default configured database connection will be used.
Retrieving a particular table for a given database connection
Here, as no database connection was specified as second argument, the default configured database connection will be used.
Retrieving the columns of a particular table for a given database connection
Here, as no database connection was specified as second argument, the default configured database connection will be used.
Retrieving the indexes of a particular table for a given database connection
Here, as no database connection was specified as second argument, the default configured database connection will be used.
Retrieving the foreign keys of a particular table for a given database connection
Here, as no database connection was specified as second argument, the default configured database connection will be used.
Retrieving a particular column of a particular table for a given database connection
Here, as no database connection was specified as third argument, the default configured database connection will be used.
Retrieving a particular index of a particular table for a given database connection
Here, as no database connection was specified as third argument, the default configured database connection will be used.
Retrieving a particular foreign key of a particular table for a given database connection
Here, as no database connection was specified as third argument, the default configured database connection will be used.
Collections
The collections provided by this package all extend the abstract VicGutt\InspectDb\Collections\Entities\EntityCollection
class which itself extends from the default Laravel collection (Illuminate\Support\Collection
).
The available collections are:
- VicGutt\InspectDb\Collections\Entities\
TableCollection
- VicGutt\InspectDb\Collections\Entities\
ColumnCollection
- VicGutt\InspectDb\Collections\Entities\
IndexCollection
- VicGutt\InspectDb\Collections\Entities\
ForeignKeyCollection
The above collections differ slightly from the default Laravel collection and behavior you might be used to. That is, our collections internal items can only ever be an array of the entities they represent. As an example, the TableCollection
items can only ever be an array of Table
s.
In usage, this translates to type errors being thrown when some collection methods are used:
The solution to this is to convert our Collection into a default Laravel collection prior to calling methods which returns new instances of the current collection but with mutated items:
This behavior, although admittedly surprising, helps guarantee a collection of Xs only ever actually contains Xs.
Entities
Entities are meant to represent units present in a given database.
The available entities are:
- VicGutt\InspectDb\Entities\
Table
- VicGutt\InspectDb\Entities\
Column
- VicGutt\InspectDb\Entities\
Index
- VicGutt\InspectDb\Entities\
ForeignKey
Click on any of the listed entities above to learn more about the exposed properties and methods.
Testing
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
If you're interested in contributing to the project, please read our contributing docs before submitting a pull request.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Victor GUTT
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-inspect-db with dependencies
doctrine/dbal Version ^3.4
illuminate/contracts Version ^10.0
spatie/laravel-package-tools Version ^1.9.2
vicgutt/php-enhanced-enum Version ^0.1.0