PHPackages                             antonioprimera/laravel-admin-panel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. antonioprimera/laravel-admin-panel

AbandonedArchivedLibrary[Admin Panels](/categories/admin)

antonioprimera/laravel-admin-panel
==================================

A simple Laravel Admin Panel

v2.7(4y ago)047MITBlade

Since Jan 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/AntonioPrimera/laravel-admin-panel)[ Packagist](https://packagist.org/packages/antonioprimera/laravel-admin-panel)[ RSS](/packages/antonioprimera-laravel-admin-panel/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (10)Dependencies (4)Versions (23)Used By (0)

Laravel Admin Panel
===================

[](#laravel-admin-panel)

Although a lot of packages and solutions exist for creating an Admin Panel for Laravel Applications, I find most of them too complicated to set up and manage.

The idea for this package is to have as quick as possible an admin panel set up for any Laravel Application.

How it all works
----------------

[](#how-it-all-works)

The principle behind is very simple: the package sets up a layout for the admin panel, and you can create admin pages, as Livewire or Blade components. Once you register each page in the config `adminPanel.pages`, your pages will be visible in the admin panel.

---

Installation
------------

[](#installation)

Install the package in your Laravel 8+ application via composer:

`composer require antonioprimera\laravel-admin-panel`

**Note:** This package is not yet tested with Laravel 9+, but in principle it should work.

If your project uses TailwindCss v2 / Tailwind v3, you are all set if the css file containing the tailwind classes is `public/css/app.css`.

**Note**: the admin panel requires the TailwindCss plugin `@tailwindcss/forms`!

### If TailwindCss is in a file, other than 'css/app.css'

[](#if-tailwindcss-is-in-a-file-other-than-cssappcss)

If the TailwindCss classes are found in another file, you should configure the asset path in config file "adminPanel.php" (either publish it from the package or create a new one):

`'projectTailwindCss' => 'css-folder/some-other-css-file.css',`

### If your project doesn't use TailwindCss v2+

[](#if-your-project-doesnt-use-tailwindcss-v2)

If your project doesn't use TailwindCss v2+, you should set the projectTailwindCss config entry to boolean false. The admin panel will use TailwindCss 3 from CDN.

---

Usage
-----

[](#usage)

By default, after installing the package and following the steps in the installation guide, you should be able to access your admin panel in the browser at `http://your-local-project.url/admin-panel`.

---

The Admin Panel Configuration
-----------------------------

[](#the-admin-panel-configuration)

You can create your own `adminPanel.php` config file, or you can publish the package config via:

`php artisan vendor:publish --tag=admin-panel-config`

### adminPanel.pages

[](#adminpanelpages)

This config key will hold the list and definition of all admin pages in the admin panel.

Let's start with an example for a 'Site Settings' admin page:

```
return [
    'pages' => [
        'site-settings' => [
            'name'      => 'Site Settings',                                                 //required
            'view'      => MyProject\Html\Livewire\SiteSettingsAdminPageComponent::class,   //required
            'icon'      => 'heroicon:cog',                                                  //recommended
            'menuLabel' => 'Site Settings',                                                 //optional
            'position'  => 0,                                                               //optional
            'viewData'  => ['defaultTheme' => 'dark', 'otherData' => 'other stuff'],        //optional
        ],

        //... other pages
    ],
];
```

#### name (required)

[](#name-required)

This is a mandatory setting for each page. This is the human-readable name and title of the admin page. If the 'menuLabel' is not provided, this name will be used also as the label of this page in the admin panel menu.

#### view (optional)

[](#view-optional)

If you don't need some complex logic, you can just create a view and use it as an admin page. This view will be wrapped in the admin panel layout.

You can use a livewire component (recommended), a blade component or an inline view.

###### View Option 1: Admin Page Livewire Components

[](#view-option-1-admin-page-livewire-components)

The recommended approach is to create Livewire components for the Admin Pages. These are default Livewire Components and don't have any restrictions. You can use TailwindCss v3 styling.

e.g.

```
    'view' => MyProject\Html\Livewire\SomeAdminPageComponent::class
```

###### View Option 2: Admin Page Blade Files

[](#view-option-2-admin-page-blade-files)

The blade files should have a single root node (for future compatibility). You can use TailwindCss v3 styling.

e.g.

```
    'view' => 'path.to.the-blade-file'
```

###### View Option 3: Inline html

[](#view-option-3-inline-html)

Although not recommended, you can use inline HTML for the admin page view. This might be useful if you have some components in a front-end JS Framework (like VueJS) and you don't want to create a blade file with a single line of html.

e.g.

```
    'view' => ''
```

#### icon (recommended)

[](#icon-recommended)

The Admin Panel package uses a simple package which enables simple HeroIcons integration. You can check out this package at: [antonioprimera/laravel-heroicons](https://packagist.org/packages/antonioprimera/laravel-heroicons)

This allows you to define an icon from the [heroicons](https://heroicons.com/) page for each page, by simply using the icon name, prefixed with 'heroicon:' or 'hero:'.

e.g. to use the 'cog' icon, you can just write

```
    'icon' => 'heroicon:cog',   //or just 'hero:cog'
```

If you don't provide an icon, the AdminPanel will provide a default icon, but all pages without a defined icon will have use the same icon in the menu.

#### menuLabel (optional)

[](#menulabel-optional)

By default, the Admin Page Name will be used as the page label in the menu. In some cases you might want to define a different label (for example if the name is very long).

e.g.

```
    'name'      => 'My Awesome Site Settings',
    'menuLabel' => 'Settings',
```

#### position (optional)

[](#position-optional)

By default, admin pages show in a pseudo-random order in the admin panel menu, based on where they are defined. If you want to set a specific order, you can define the page position as an integer.

#### viewData (optional)

[](#viewdata-optional)

By default, if the admin page view is self-sufficient, you can ignore this attribute. If you use a generic Livewire or Blade component, which needs some data assigned, you can use this attribute to define an array of data.

e.g.

```
    'viewData' => ['webComponentUid' => 'home-page'],
```

#### url (optional)

[](#url-optional)

If you want to have an admin page point to a specific url, you can provide the full url here. If you don't provide an url or a route, you must provide a view (Livewire / blade / inline), which the AdminPanel will associate with its own route `admin-panel/{uid}`. In this case the uid will be used to differentiate the admin page.

e.g.

```
    'url' => '/products/index',
```

#### route (optional)

[](#route-optional)

If you use named routes, you can provide a route name, to determine the corresponding url. This is an alternative to the `url` attribute (use one or the other, don't use both).

e.g.

```
    'route' => 'products.index',
```

#### uid (optional)

[](#uid-optional)

By default, each page has a unique id, which is the array key of the admin page configuration. You can set a specific uid for a page, to override a previously registered admin page with the same uid. Setting the Uid by yourself, might produce unexpected results, so, only do this if you know what you're doing.

### adminPanel.layout

[](#adminpanellayout)

The `adminPanel.layout` config determines the layout blade file to be used for the admin panel. By default, the layout is `admin-panel::layouts.default`.

### adminPanel.projectTailwindCss

[](#adminpanelprojecttailwindcss)

The `adminPanel.projectTailwindCss` config determines the location of the css file containing the tailwind css classes, relative to your public folder (by default 'css/app.css'). If your project doesn't use tailwind css or if you want a clean and complete tailwind css file (from the tailwind cdn), you can set this entry to boolean false.

#### adminPanel.routePrefix

[](#adminpanelrouteprefix)

This is the route prefix for all admin panel pages and also the route to the admin panel dashboard (the entry point to the admin panel). By default, this is `admin-panel`, so that your admin panel can be accessed at `https://your.project.url/admin-panel`. If you want to better secure your admin panel, you can use a random route prefix, configurable in `adminPanel.routePrefix` or as an ENV variable:

`ADMIN_PANEL_ROUTE_PREFIX="/random/admin-panel/prefix"`

#### adminPanel.middleware

[](#adminpanelmiddleware)

You can define the middleware to be applied to all admin-panel pages. By default, the following middleware is configured to be applied `'middleware' => ['web', 'auth']`.

You can set the env attribute `ADMIN_PANEL_MIDDLEWARE` to a comma separated list of middleware, without overriding the default config. This allows you, for example, to just use the 'web' middleware (without 'auth') in your development environment, so you don't have to create a user and log in every time to access your admin-panel.

e.g. `ADMIN_PANEL_MIDDLEWARE="web,some-special-middleware"`

Using your own Controllers to add views to the Admin Panel
----------------------------------------------------------

[](#using-your-own-controllers-to-add-views-to-the-admin-panel)

Starting with version 2.2 of the admin-panel, you can roll your own admin pages and easily add them to the admin panel. This is especially useful if you want to associate more than one page with an admin panel menu item.

For example, if you have an '/admin-panel/products' page listing all your products, configured in your adminPanel config file, you can add a product detail page to your admin panel, under the same admin page (the same menu item appears as active): '/admin-panel/products/{product}'.

### The admin panel layout blade component

[](#the-admin-panel-layout-blade-component)

The admin-panel package exposes the currently configured admin panel layout as a blade component, aliased by **x-admin-page** or **x-admin-panel-layout** (two aliases for the same layout).

The layout component accepts an optional parameter `uid`, which can be used to show one of the pages in the menu as active. Behind the scenes, the view uses `AdminPanel::setCurrentPageUid();` to set the given uid as the currently active admin page uid in the admin panel.

e.g.

```
//your adminPanel config - you must provide the proper url or route name for the admin page
return [
    //...
    'pages' => [
        'machines' => [
            'name' => 'Products'
            'icon' => 'hero:cog',
            'url' => '/products',   //or 'route' => 'products.index'
        ],
    ],
]
```

```
//your Controller - no special treatment here
class MachineManager extends Controller
{
    public function index()
    {
        return view('machines.index', ['products' => Products::available()->get()]);
    }
}
```

```
//your routes file (usually: routes/web.php) - no special treatment here
Route::get('/machines', [MachineController::class, 'index'])->name('machines.index');
```

```

    ... your admin page content goes here ...

```

Package development &amp; extending the Admin Page
--------------------------------------------------

[](#package-development--extending-the-admin-page)

The Admin Panel is intended to be easily integrated into existing laravel applications, but also easily extended and used in other packages, where you want to publish admin pages to give your users access to some aspects of your package.

### The AdminPanel Facade

[](#the-adminpanel-facade)

Through the AdminPanel Facade you have access to all settings of the admin panel and its admin pages. You can get all admin pages, add new ones.

You can use this facade if you want to build your own admin panel layout, to read all admin pages and add menu items for all admin pages.

### The AdminPage instances

[](#the-adminpage-instances)

The Admin Panel generates an `AntonioPrimera\AdminPanel\AdminPage` instance for each individual admin page. This class exposes all properties of the admin page - their Url, Name, Uid, View, View Data etc.

### Generating admin pages in your packages

[](#generating-admin-pages-in-your-packages)

You can easily add admin pages for your package, without having to require this package, by simply adding a page collector class in your Service Container and tagging it 'admin-pages'.

Here's an example for a HeroIcons package, which adds an admin page listing all available hero icons:

```
//WebPageServiceProvider.php

public function register()
{
    //...
    $this->app->bind(HeroIconsAdminPageCollector::class);
    $this->app->tag(HeroIconsAdminPageCollector::class, 'admin-pages');
}
```

This page collector class can be any class, with a simple public method named 'resolve', which returns an array of page configurations, exactly what you would write in your `adminPanel.pages` config.

Here's an example of a simple admin page collector for a package of HeroIcons:

```

class HeroIconsAdminPageCollector
{

    public function resolve()
    {
        return [
            'hero-icons-admin-page' => [
                'name'      => 'Hero Icons',
                'icon'      => 'heroicon:shield-check',
                'view'      => 'hero-icons::admin-panel.icons-list',
                'viewData'  => ['icons' => HeroIcons::all()],
            ],
        ];
    }
}
```

Of course, you can even generate admin pages dynamically for models from the DB or any items in your package.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

22

Last Release

1475d ago

Major Versions

v1.13 → v2.02022-03-16

### Community

Maintainers

![](https://www.gravatar.com/avatar/77cac31fc31444fb45ef19e3628a7b243b5456679a9e6db635aa3b979bfdbefc?d=identicon)[AntonioPrimera](/maintainers/AntonioPrimera)

### Embed Badge

![Health badge](/badges/antonioprimera-laravel-admin-panel/health.svg)

```
[![Health](https://phpackages.com/badges/antonioprimera-laravel-admin-panel/health.svg)](https://phpackages.com/packages/antonioprimera-laravel-admin-panel)
```

###  Alternatives

[power-components/livewire-powergrid

PowerGrid generates Advanced Datatables using Laravel Livewire.

1.7k1.7M6](/packages/power-components-livewire-powergrid)[filament/support

Core helper methods and foundation code for all Filament packages.

2323.9M151](/packages/filament-support)[litstack/litstack

Laravel Content-Administration

86132.5k8](/packages/litstack-litstack)[guava/filament-nested-resources

162172.1k2](/packages/guava-filament-nested-resources)[andreia/filament-ui-switcher

Add a modal with options to switch between different UI layouts and styles (colors, fonts, font sizes).

233.8k](/packages/andreia-filament-ui-switcher)[a2insights/filament-saas

Filament Saas for A2Insights

161.1k](/packages/a2insights-filament-saas)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
