techweb-sk / rareadmin
RareAdmin v2 - a database-configurable admin panel for any Laravel application. Point it at your Eloquent models and get a full CRUD panel with roles, permissions, import/export and a modern dependency-free UI.
Requires
- php: ^8.2
- illuminate/database: ^11.0|^12.0
- illuminate/support: ^11.0|^12.0
Suggests
- phpoffice/phpspreadsheet: Required to import XLS/XLSX spreadsheets (CSV import works out of the box).
README
Point RareAdmin at your Eloquent models and get a complete admin panel in minutes — data tables, generated forms, roles & permissions, import/export and impersonation. Everything is configured at runtime from inside the panel itself, so the same install adapts to any database structure.
v2 is a ground-up rewrite of the original RareAdmin with a modern, dependency-free UI (no jQuery, no Bootstrap, no CDN assets), a safer architecture and a far better editing experience.
📖 Documentation: the full guide — every entity option, all 18 field types, the permission model, import/export and extension APIs — lives in site/docs (a static site: host it anywhere, e.g. rareadmin.com, or open it straight from the repo). The landing page is site/index.html. It's also built into the panel: every installation serves its own version-matched copy at /admin/help (book icon in the sidebar footer) — works offline, no publishing needed.
Highlights
- One-command install —
rareadmin:installmigrates, creates roles, discovers your models and assigns the first administrator. - Model discovery via reflection — relations (
belongsTo,belongsToMany,morphTo) are detected from your model classes, including untyped relation methods. No more source-file parsing. - 18 field types — text, long text, rich text, code, number, yes/no, date, date & time, e-mail, URL, password (auto-hashed), color, select, image(s) with automatic GD thumbnails, file(s), belongs-to, many-to-many and polymorphic parents. Field types are PHP classes — add your own via config.
- Modern UI — light & dark theme, command palette (Ctrl+K), inline boolean toggles, async searchable relation pickers, drag & drop reordering, bulk actions, sticky save bar, responsive down to phones. All assets served straight from the package — zero publish steps.
- Roles & permissions matrix — per-entity view/create/edit/delete plus per-field overrides (hidden / read-only / editable). Admin roles bypass everything; roles are managed like any other entity.
- Safe by design — every mutation is a POST/PUT/DELETE with CSRF, validation rules per field (
unique:users,email,{id}supported), and the panel only ever writes fields you configured — your models need no$guarded/$fillablechanges. - Import & export — CSV import works out of the box (XLS/XLSX with
phpoffice/phpspreadsheet), with column auto-mapping, relation resolution by name ("Travel" →category_id),a; b; clists for many-to-many, and per-row error reporting instead of all-or-nothing. Filtered CSV export for every entity. - Impersonation — admins can browse as any non-admin user to verify permissions, with a persistent banner and one-click return.
- Form layout — arrange form fields on a 12-column grid (1/1, 3/4, 2/3, 1/2, 1/3, 1/4), add section headings and row breaks, set editor height for text fields, and pick the form's width — all from the entity editor, responsive down to a single column on phones.
- Schema sync — configure ahead of your code: add fields (or whole new entities) whose columns, tables, pivot tables, model classes or relation methods don't exist yet, and RareAdmin detects the gap, keeps the panel working, previews the generated migration/model code, and applies it with one click (
php artisan migrateincluded). Real migration files, committed like hand-written ones.
Requirements
- PHP 8.2+
- Laravel 11 or 12
- Any database supported by Laravel (MySQL, MariaDB, PostgreSQL, SQLite, SQL Server)
- Auth is optional: if your app has any (Breeze / Fortify / laravel/ui / your own
loginroute) the panel uses it; on a completely fresh Laravel install RareAdmin serves its own sign-in screen at/admin/loginautomatically
Installation
composer require techweb-sk/rareadmin php artisan rareadmin:install --admin=you@example.com
That's it. Open /admin and sign in with the user you named — the panel is already populated with every model found in app/Models. Works on a completely fresh Laravel install too: with no auth scaffolding RareAdmin serves its own sign-in screen, and with an empty users table the installer creates the administrator account for you (interactive prompts, or a generated password printed once when run with --no-interaction).
The installer:
- runs the migrations (four
rareadmin_*tables + a nullablerareadmin_role_idcolumn onusers), - creates three roles: Administrator, Editor, Viewer,
- discovers your models and registers them as entities,
- assigns the Administrator role to the given user (or the first user) — creating the account first if it doesn't exist yet.
Prefer doing it manually? php artisan migrate + php artisan rareadmin:discover do the same thing step by step.
Images: run
php artisan storage:linkand make sureAPP_URLmatches the URL you browse on, otherwise upload previews will not resolve.
Configuration
php artisan vendor:publish --tag=rareadmin-config
Key options in config/rareadmin.php:
| Option | Default | Purpose |
|---|---|---|
path |
admin |
URL prefix of the panel |
middleware |
['web', 'auth'] |
Middleware stack under the panel |
brand |
RareAdmin |
Name shown in the sidebar |
uploads.disk / directory |
public / rareadmin |
Where image/file fields store uploads |
uploads.thumbnail |
320 |
Thumbnail size (GD, no extra package) |
impersonation |
true |
Enable "Sign in as" on the users entity |
fields |
— | The field type registry — append your own classes |
discovery.hidden_by_default |
passwords etc. | Columns registered but hidden from lists & forms |
Everyday use
- Entities (Settings → Entities) are the modules of the panel. Each maps a table + model to a full CRUD UI: title, icon (built-in picker), sidebar group, default sort, rows per page and the full field list — drag to reorder, toggle List/Form/Required per field, expand a row for validation rules, help text and relation options.
- Discover models re-scans
app/Modelsany time you add a model, and proposes new entities with sensible types, labels and relations — nothing is registered without your confirmation. - Permissions (Settings → Permissions): pick a role, tick view/create/edit/delete per entity, and expand an entity to override single fields as Hidden / Read-only / Editable. Users get a role via the Role field on the Users entity.
- Import: every entity's Actions menu → Import. Upload a spreadsheet, map columns (auto-matched when the file has a header row), and run — failed rows are reported individually with reasons.
Extending field types
// config/rareadmin.php 'fields' => [ // ...defaults... 'stars' => \App\Rareadmin\StarsField::class, ],
class StarsField extends \TechwebSk\Rareadmin\Fields\FieldType { public function baseRules($field): array { return ['integer', 'between:0,5']; } public function formView(): string { return 'admin.fields.stars'; } // your Blade view }
A field type controls its form input, table cell, validation, persistence, search and sorting. See src/Fields/ for examples — BelongsToField is a complete relation implementation in ~150 lines.
Upgrading from v1
See UPGRADE.md. In short: v2's migration detects v1 tables, backs them up as *_v1, carries your roles and user role assignments over, and you re-run discovery for entities (the v1 column/type configuration is incompatible — types are now PHP classes instead of HTML templates stored in the database).
License
The MIT License (MIT). Please see License File for more information.