Database management dashboard based on Jaxon and Adminer
This package is auto-updated.
Last update: 2022-06-27 16:16:11 UTC
This package is based on Adminer.
It inserts a database admin dashboard into an existing PHP application. Thanks to the Jaxon library, it installs and runs in a page of the application. All its operations are performed with Ajax requests.
Install the jaxon library so it bootstraps from a config file and handles ajax requests. Here's the documentation.
Install this package with Composer. If a Jaxon plugin exists for your framework, you can also install it. It will automate the previous step.
Install the drivers packages for the database servers you need to manage. The following drivers are available:
- MySQL: https://github.com/lagdo/dbadmin-driver-mysql
- PostgreSQL: https://github.com/lagdo/dbadmin-driver-pgsql
- Sqlite: https://github.com/lagdo/dbadmin-driver-sqlite
Declare the package and the database servers in the
app section of the Jaxon configuration file.
See the corresponding database driver package for specific database server options.
'app' => [ // Other config options // ... 'packages' => [ Lagdo\DbAdmin\Package::class => [ 'servers' => [ // The database servers ], ], ], ],
In the page that displays the dashboard, insert the HTML code returned by the call to
jaxon()->package(\Lagdo\DbAdmin\Package::class)->getHtml(). Two cases are then possible.
If the dashboard is displayed on a dedicated page, make a call to
jaxon()->package(\Lagdo\DbAdmin\Package::class)->ready()in your PHP code when loading the page.
jaxon()->package(\Lagdo\DbAdmin\Package::class)->getReadyScript()after the page is loaded.
This package uses the HTML UI builder to build UI components for various frontend frameworks. The packages for the UI framework in use must also be installed. The following builders are available:
- Bootstrap 3, 4 and 5: https://github.com/lagdo/ui-builder-bootstrap
In this case, the UI will be built with Bootstrap3 components, using the https://github.com/lagdo/ui-builder-bootstrap package.
'app' => [ 'packages' => [ Lagdo\DbAdmin\Package::class => [ 'template' => 'bootstrap3', ], ], ],
There are other config options that can be used to customize
Jaxon DbAdmin operation.
default option sets a database server
Jaxon DbAdmin must connect to when it starts.
'app' => [ 'packages' => [ Lagdo\DbAdmin\Package::class => [ 'servers' => [ // The database servers ], 'default' => 'server_id', ], ], ],
access section provides a few options to restrict access to databases on any server.
access.server option is set to
false at package level, then the access to all servers information will be forbidden, and the user will have access only to database contents.
access.server option can also be set at a server level, and in this case it applies only to that specific server.
'app' => [ 'packages' => [ Lagdo\DbAdmin\Package::class => [ 'servers' => [ // The database servers 'server_id' => [ // Database options 'access' => [ 'server' => true, ], ], ], 'default' => 'server_id', 'access' => [ 'server' => false, ], ], ], ],
In this configuration, the user will get access to server information only on the server with id
access.schemas options define the set of databases and schemas the user can access.
This options can only be defined at server level, and will apply to that specific server.
access.schemas option will apply only on servers which provide that feature.
'app' => [ 'packages' => [ Lagdo\DbAdmin\Package::class => [ 'servers' => [ // The database servers 'server_id' => [ // Database options 'access' => [ 'server' => false, 'databases' => ['db1', 'db2', 'db3'], 'schemas' => ['public'], ], ], ], 'default' => 'server_id', ], ], ],
In this configuration, the user will be able to get access only to three databases on the server with id
Starting from version
0.9.0, the SQL queries that are executed can also be printed in the browser debug console,
debug.queries option is set to true.
'app' => [ 'packages' => [ Lagdo\DbAdmin\Package::class => [ 'debug' => [ 'queries' => true, ], 'servers' => [ // The database servers ], ], ], ],
SQL files can be uploaded and executed on a server. This feature is implemented using the Jaxon ajax upload feature, which then needs to be configured in the
lib section of the
Jaxon config file.
'lib' => [ 'upload' => [ 'files' => [ 'sql_files' => [ 'dir' => '/path/to/the/upload/dir', ], ], ], ],
As stated in the Jaxon ajax upload documentation,
sql_files is the
name attribute of the file upload field, and of course
/path/to/the/upload/dir needs to be writable.
Other parameters can also be defined to limit the size of the uploaded files or retrict their extensions or mime types.
Databases can also be exported to various types of files: SQL, CSV, and more. A directory where the exported files are going to be saved must then be defined in the configuration, as well as an url where they can be downloaded.
'app' => [ 'packages' => [ Lagdo\DbAdmin\Package::class => [ 'servers' => [ // The database servers ], 'export' => [ 'dir' => '/path/to/the/export/dir', 'url' => 'http://www.domain.com/exports', ], ], ], ],
The web server needs to be setup to serve the files in the directory
dir from url
- Issue Tracker: github.com/lagdo/jaxon-dbadmin/issues
- Source Code: github.com/lagdo/jaxon-dbadmin
The project is licensed under the Apache license.