Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

bearbytestudio's avatar

How capable and flexible is Filament?

Hi there!

I am building a suite of laravel applications, and I am most comfortable with InertiaJS/ReactJS, but I have used Filament before and appreciate it's speed to get things done, especially with things like admin panels.

I would love to start using it more, but have a few scenarios in upcoming projects where I am not sure Filament is flexible enough to handle, but would love to be told otherwise!

  1. I need to build a page where after a user has uploaded a PDF, they are able to view the PDF on the left 1/2 of the screen, and a form is on the right 1/2 of the screen. They essentially fill out the form according to the PDF.
  2. I need to show a list of "pending" workflows, which refreshes every 5-10 seconds to fetch updated information from the database. Once all workflows are completed, the polling stops.

Both of the above I have built easily in InteriaJS/ReactJS, but it obviously took much longer as I had to build out a entire frontend.

Any notes appreciated!

0 likes
1 reply
LaryAI's avatar
Level 58

Filament is a powerful tool for building admin panels in Laravel applications, and it can be quite flexible with some customizations. Let's address your scenarios:

  1. PDF Viewing and Form Filling:

    Filament can handle this scenario by leveraging custom pages and components. You can create a custom page in Filament where you use a JavaScript library to display the PDF on one side and a form on the other. Here's a basic outline of how you might achieve this:

    • Create a Custom Page: Use Filament's custom page feature to create a new page.
    • PDF Display: Use a JavaScript library like pdf.js to render the PDF in a <div> on the left side of the page.
    • Form: Use Filament's form components on the right side of the page.

    Here's a rough example of how you might set up the page:

    // In your Filament page class
    public function render()
    {
        return view('filament.pages.custom-pdf-form', [
            'pdfUrl' => $this->getPdfUrl(), // Method to get the PDF URL
        ]);
    }
    
    <!-- In your Blade view (resources/views/filament/pages/custom-pdf-form.blade.php) -->
    <div style="display: flex;">
        <div style="flex: 1;">
            <!-- PDF.js viewer -->
            <div id="pdf-viewer"></div>
        </div>
        <div style="flex: 1;">
            <!-- Filament form -->
            <form>
                <!-- Your form fields here -->
            </form>
        </div>
    </div>
    
    <script>
        // Use PDF.js to render the PDF
        const url = "{{ $pdfUrl }}";
        // Initialize PDF.js and render the PDF in the #pdf-viewer div
    </script>
    
  2. Polling for Pending Workflows:

    For the polling feature, you can use JavaScript to periodically fetch data from the server and update the UI. Filament doesn't have built-in polling, but you can easily implement it with a bit of JavaScript.

    • JavaScript Polling: Use setInterval to fetch data every 5-10 seconds.
    • Stop Polling: Check the response to determine if all workflows are completed and stop polling if they are.

    Here's a simple example:

    function fetchPendingWorkflows() {
        fetch('/api/pending-workflows')
            .then(response => response.json())
            .then(data => {
                // Update your UI with the data
                if (data.allCompleted) {
                    clearInterval(pollingInterval);
                }
            });
    }
    
    const pollingInterval = setInterval(fetchPendingWorkflows, 5000);
    
    • Backend Endpoint: Create an API endpoint in Laravel to return the pending workflows.
    Route::get('/api/pending-workflows', function () {
        $workflows = Workflow::where('status', 'pending')->get();
        return response()->json([
            'workflows' => $workflows,
            'allCompleted' => $workflows->isEmpty(),
        ]);
    });
    

By combining Filament's capabilities with some custom JavaScript and Blade templates, you can achieve the flexibility you need for these scenarios.

Please or to participate in this conversation.