How to use Filament PHP with laravel

Roberta AkotoRoberta Akoto
2 min read

Filament PHP is an open-source package for the Laravel PHP framework. It is a library of components for quickly building admin interfaces for Laravel applications.

Prerequisites

  • PHP version 8.1

  • Laravel 10

  • Livewire

By this time, you would have created your Laravel project. If you don't know how to, you can follow this tutorial.

NB: Filament PHP uses TailwindCSS as well. And do well to update your PHP version

Installing Livewire

Livewire is also a full-stack framework for Laravel that makes building dynamic interfaces simple in Laravel.

composer require livewire/livewire

Installing Filament

First, install the package

> composer require filament/filament:"^3.0-stable" -W
> php artisan filament: install --panels

This installs filament and creates a basic admin panel for you. Now we have to create a user so that we can access this admin panel created.

First, let's configure our .env file to have a database name and MySQL details to be able to create our user.

Login to the MySQL Database

In your computer terminal, run mysql -u root -p

This will ask for your root password. After entering the password, you are now logged in to MySQL.

Now create your database using this command CREATE DATABASE blog;

Now run your migrations to create your database files Php artisan migrate

Creating a User

Let's create our admin user now by using this command php artisan make:filament-user

Now we can test this by hitting http://localhost/admin/login. which will take us to the login page where we can put in the details we used to create the user.

I will see you on the next one. Happy Coding!

0
Subscribe to my newsletter

Read articles from Roberta Akoto directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Roberta Akoto
Roberta Akoto

Hi there ๐Ÿ‘‹๐Ÿพ, I am a software engineer with a diverse background in software engineering, product management, and technology domains such as EdTech, FinTech, and AgriTech. I am passionate about exploring new technologies and industry trends and believe in continuous learning and improvement.