Customizations for Adminer, the best database management tool written in PHP.
- clean design
- visual resolution for production/development servers
- SQL autocomplete plugin
- plugin that dumps to PHP code
- plugin that saves menu scroll position
- plugin that allows magic login with Wasmer (see Magic Login section below)
You can test the plugin locally by running the following command:
mkdir data
wasmer run . --net --mapdir=/data:data --env="WASMER_GRAPHQL_URL=https://registry.wasmer.io/graphql"
This will start the Adminer application in a Wasmer container and map the current directory to the /data directory.
composer require dg/adminer
Create file index.php somewhere in your document root, for example in subdirectory adminer/:
<?php
touch(__DIR__ . '/adminer.css');
require __DIR__ . '/../../vendor/dg/adminer/index.php'; // CHECK THAT THIS PATH IS CORRECTAnd then navigate your browser to this directory (i.e. http://localhost/adminer).
If you want to login automatically (use that for non-public environment only, e.g. localhost), you can do that by setting environment variables ADMINER_SERVER, ADMINER_USERNAME and ADMINER_PASSWORD. If you want to be automatically redirected to https, set ADMINER_HTTPS_REDIRECT environment variable to true.
The magic login feature allows users to authenticate and connect to databases using a temporary token from the Wasmer backend, without manually entering credentials.
-
User receives a magic login URL from the Wasmer platform with the format:
https://your-adminer.wasmer.dev/?magiclogin=<token>&dbid=<database_id>Example:
https://wordpress-865zz.wasmer.dev/?magiclogin=wott_IC5J7NJ3AYCBI2FXRRKDB37SBR5NS3RI&dbid=db_abc123 -
The token is validated by querying the Wasmer GraphQL API:
- The token (starting with
wott_) is a backend authentication token from Wasmer - Adminer sends a GraphQL query to
WASMER_GRAPHQL_URLwith the token as Bearer authentication - The Wasmer backend validates the token and returns database credentials if the user is authorized
- The token (starting with
-
Database credentials are retrieved from the GraphQL response:
- Host and port
- Username and password
- Database name
- App metadata (for validation and navigation)
-
Automatic login is performed:
- The credentials are automatically injected into Adminer's authentication system
- User is logged into the database without seeing the login form
- A "Go to Wasmer App Dashboard" link is added to the navigation
-
WASMER_GRAPHQL_URL(required): URL to Wasmer's GraphQL API- Example:
https://registry.wasmer.io/graphql - This is where the magic login token is validated
- Example:
-
WASMER_APP_ID(optional): Restricts database access to a specific app ID- When set, only databases belonging to this app can be accessed
- Provides additional security layer
- Example:
app_xyz789
If the magic login link redirects to the login form instead of the admin page:
-
Check environment variables: Ensure
WASMER_GRAPHQL_URLis set correctlyecho $WASMER_GRAPHQL_URL
-
Verify token validity: The
wott_*token may be expired or invalid- Tokens are temporary and have an expiration time
- Request a new magic login link
-
Check authorization: The user may not have access to the requested database
- Verify the user has permissions for the database ID in the Wasmer platform
-
Validate app matching: If
WASMER_APP_IDis set, ensure it matches the database's app- The database must belong to the configured app
-
Check for CORS errors: Look in the browser console for CORS-related errors
- This may indicate domain configuration issues
- The magic login token (
wott_*) is validated by the Wasmer backend, not stored locally. - Token validation happens server-side via the GraphQL API.
- Tokens are temporary and expire after a certain time period.
- When
WASMER_APP_IDis configured, only databases from that specific app can be accessed. - The admin URL is stored in a cookie for 1 hour to enable navigation back to the dashboard.