Download the PHP package monicahq/laradb without Composer

On this page you can find all versions of the php package monicahq/laradb. 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 laradb

LaraDB — A read-only database browser for your Laravel application.

Have you ever had this problem?

LaraDB is a package that gives you a route to inspect the local db in your browser.

Install it, open /db, and get your tables on the left and their rows on the right — a small phpMyAdmin, without the server, the login screen, or the write access.

Works with MySQL / MariaDB, PostgreSQL and SQLite.

The page ships its own CSS and JavaScript.


⚠️ Read this before you install it

LaraDb renders the contents of your database in a web page. Every row of every table, to anyone who can reach the URL.


Installation

Install it as a development dependency:

The service provider is auto-discovered. In a local environment, that is all you need: visit /db.

Publish the config to change anything:

The views can be published too, if you want to restyle them:

Usage

Simply go to /db URL in your project, and the screen will shown. You can configure this URL - see section below.

Configuration

config/laradb.php:

Key Default What it does
enabled null null means "only in local". Set true/false (or LARADB_ENABLED) to decide explicitly.
route_prefix 'db' Where the viewer is mounted.
middleware ['web', 'auth'] The middleware stack applied to both routes.
connection null The connection to browse, as named in config/database.php. null uses the default one.
per_page 25 Rows per page.
max_cell_length 120 Long values are truncated to this many characters, full value in the tooltip. 0 disables it.

Each has an environment variable: LARADB_ENABLED, LARADB_ROUTE_PREFIX, LARADB_CONNECTION, LARADB_PER_PAGE, LARADB_MAX_CELL_LENGTH.

Who can reach it

Three separate things decide that. They are a stack, not alternatives: each is a place the viewer can be stopped, and they fail independently. The warning at the top of this file names them; here is how to set each one.

1. Whether it is installed at all. composer require --dev keeps LaraDb out of a production build entirely — composer install --no-dev on deploy and there is no package, no service provider, no route to protect. Nothing else here is as strong, because nothing else here can be misconfigured.

2. Whether the routes are registered. enabled is null by default, which means "only in local". A staging or production box has no /db even if the package did end up in the build. Turning it on anywhere else is a deliberate act, and it is the point at which layer 3 stops being optional:

3. Who gets past the middleware. This is the one you have to write. The default stack is ['web', 'auth'], which only proves the visitor is someone — every logged-in user of your application passes it, including the test account you made six months ago. Put an authorisation check on top:

The stack applies to the whole route group, so the page, the HTML fragment and the JSON endpoint are all behind the same gate. A user who fails it gets a 403.

Emptying this setting does not turn the gate off — null and [] both fall back to ['web', 'auth']. Laravel drops a route group's middleware key when it is not set, so the alternative would be publishing the whole database unauthenticated because a config value was blank. If you genuinely want the viewer reachable without logging in, ask for it: ['web'].

What is not one of the three

route_prefix moves the viewer; it does not hide it. A URL is not a secret: it turns up in access logs, browser history, Referer headers and whatever error tracker you have installed, and it is one shoulder-surf from being public. Set it because /db collides with a route of your own, or to keep LaraDb out of the way — not to a random string you then count as a layer of defence.

Routes

Both routes are named and GET only.

Route Name Returns
GET /db laradb.index The full page. ?table= selects a table, ?page= a page.
GET /db/tables/{table} laradb.table The rows of one table, as an HTML fragment.

Both also accept ?column= and ?value=, which narrow the table to the rows whose column equals that value — this is what following a foreign key resolves to. The column has to be one a foreign key actually points at, or the request is a 404; the value is always bound, never interpolated. ?from= is the label the chip shows, and is ignored unless it names a real foreign key.

The fragment endpoint also speaks JSON, with ?format=json or an Accept: application/json header:

Using the core without Laravel

The reading side depends on nothing but PDO, so it works anywhere:

DriverInterface is the package's public contract:

The describing half is nullable throughout, and deliberately so: reading a system catalogue is a privilege. A connection whose user cannot do it gets a working viewer with a quieter header, never a 500.

foreignKeyTargets() is what decides whether a RowFilter is allowed: filtering on a column it does not list raises UnknownColumnException, which the controller turns into a 404.

What each engine reports for metadata():

Keys
SQLite page, journal, enc, fk, schema
MySQL engine, charset, collation
PostgreSQL enc, collation, schema

Any change to DriverInterface is a breaking change and gets a major version bump.

Testing

The unit and feature suites run on in-memory SQLite and need nothing installed. The MySQL and PostgreSQL suites skip themselves unless a server is reachable; point them at one with LARADB_MYSQL_DSN / LARADB_PGSQL_DSN (plus the matching _USERNAME and _PASSWORD). CI runs them against real services on every push.

Contributing

Bug reports and pull requests are welcome. Please keep Pint and PHPStan green.

Changelog

Releases and their notes are generated by semantic-release from the commit history. See the releases page.

License

MIT. See LICENSE.


All versions of laradb with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-pdo Version *
composer-runtime-api Version ^2.0
illuminate/database Version ^10.0|^11.0|^12.0|^13.0
illuminate/http Version ^10.0|^11.0|^12.0|^13.0
illuminate/routing Version ^10.0|^11.0|^12.0|^13.0
illuminate/support Version ^10.0|^11.0|^12.0|^13.0
illuminate/view Version ^10.0|^11.0|^12.0|^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 monicahq/laradb contains the following files

Loading the files please wait ...