1. Go to this page and download the library: Download vicgutt/laravel-inspect-db library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use VicGutt\InspectDb\Inspect;
// returns an instance of `VicGutt\InspectDb\Collections\Entities\TableCollection`
Inspect::tables();
use VicGutt\InspectDb\Inspect;
// returns an instance of `VicGutt\InspectDb\Entities\Table`
Inspect::table('users');
use VicGutt\InspectDb\Inspect;
// returns an instance of `VicGutt\InspectDb\Collections\Entities\ColumnCollection`
Inspect::columns('users');
use VicGutt\InspectDb\Inspect;
// returns an instance of `VicGutt\InspectDb\Collections\Entities\IndexCollection`
Inspect::indexes('users');
use VicGutt\InspectDb\Inspect;
// returns an instance of `VicGutt\InspectDb\Collections\Entities\ForeignKeyCollection`
Inspect::foreignKeys('users');
use VicGutt\InspectDb\Inspect;
// returns an instance of `VicGutt\InspectDb\Entities\Column` or null
Inspect::column('id', 'users');
use VicGutt\InspectDb\Inspect;
// returns an instance of `VicGutt\InspectDb\Entities\Index` or null
Inspect::index('PRIMARY', 'users');
use VicGutt\InspectDb\Inspect;
// returns an instance of `VicGutt\InspectDb\Entities\ForeignKey` or null
Inspect::foreignKey('posts_user_id_foreign', 'posts');
/**
* The following will throw a `TypeError` with a message specifying the "$item" given
* is a string rather than instances of `Doctrine\DBAL\Schema\Table` or `VicGutt\InspectDb\Entities\Table`.
*/
Inspect::tables()->map(fn (Table $table): string => $table->name);
Inspect::tables()->pluck('name');
/**
* Now, all is well.
*/
Inspect::tables()->toBase()->map(fn (Table $table): string => $table->name);
Inspect::tables()->toBase()->pluck('name');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.