PHPackages                             schrojf/laravel-papers - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. schrojf/laravel-papers

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

schrojf/laravel-papers
======================

Laravel papers package

v0.1.0(1y ago)03[5 PRs](https://github.com/schrojf/laravel-papers/pulls)MITPHPPHP ^8.2CI passing

Since May 26Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/schrojf/laravel-papers)[ Packagist](https://packagist.org/packages/schrojf/laravel-papers)[ Docs](https://github.com/schrojf/laravel-papers)[ GitHub Sponsors](https://github.com/schrojf)[ RSS](/packages/schrojf-laravel-papers/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (12)Versions (9)Used By (0)

Laravel Papers
==============

[](#laravel-papers)

> ⚠️ **Experimental Package — Use With Caution**
>
> Laravel Papers is still in **early development** and considered experimental. While it is functional and may be used in production environments, please be aware of the following:
>
> - The API is **not stable** and may change significantly in upcoming releases.
> - Documentation may be incomplete or subject to improvement.
> - Backward compatibility between minor versions is **not guaranteed**.
> - Use at your own risk — review the source code and test thoroughly before deploying in critical systems.
>
> Feedback, issues, and contributions are very welcome as the package evolves. If you're using it in production, consider locking to a specific version.

[![Latest Version on Packagist](https://camo.githubusercontent.com/025de3e29a6dd11ba77cdbfa016b39c5449f23439485edb77a4fb1c5dbddbeb0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736368726f6a662f6c61726176656c2d7061706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/schrojf/laravel-papers)[![GitHub Tests Action Status](https://camo.githubusercontent.com/2fe275f384b383020e636a95b48a724173479df680e3a5554328f6d19d1c92f0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736368726f6a662f6c61726176656c2d7061706572732f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/schrojf/laravel-papers/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/b5b88332669663baafb4009c7fe331ed5a4f8f3a4192477b80fab3669e1c6b93/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736368726f6a662f6c61726176656c2d7061706572732f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/schrojf/laravel-papers/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/d9070c5991296af03d6b32f38efb2761b335fd2f2106d5e776c54ffdc1698a7d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736368726f6a662f6c61726176656c2d7061706572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/schrojf/laravel-papers)

**Laravel Papers** is a lightweight and flexible package for building and displaying custom debug or reporting pages — called *Papers* — within your Laravel application. Each Paper can aggregate and display structured or unstructured data from various sources such as databases, services, or internal logic.

Originally created as an experimental project, **Laravel Papers** is ideal for internal tools, dashboards, and developer-oriented views that are simple to register and use.

[![Demo paper page with renderable components](.github/images/screenshot1.png)](.github/images/screenshot1.png)

Features
--------

[](#features)

- Create dynamic reporting pages using reusable components
- Render structured data using tables and data panels
- Secure access using Laravel's Gate authorization

Requirements
------------

[](#requirements)

- Laravel Framework 9.x, 10.x, 11.x, or 12.x
- PHP version 8.2, 8.3 or 8.4
- Modern web browser

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

[](#installation)

Install the package via Composer:

```
composer require schrojf/laravel-papers
```

Publish the configuration file (optional):

```
php artisan vendor:publish --tag="papers-config"
```

This is the default `config/papers.php` file:

```
return [

    'middleware' => [
        'web',
        \Schrojf\Papers\Http\Middleware\AuthorizePapers::class,
    ],

    'api_middleware' => [
        'api',
        \Schrojf\Papers\Http\Middleware\AuthorizePapers::class,
    ],

];
```

Publish the views (optional):

```
php artisan vendor:publish --tag="papers-views"
```

Usage
-----

[](#usage)

### Registering Papers

[](#registering-papers)

Define and register your Paper classes in a service provider, such as `AppServiceProvider.php`:

```
use Schrojf\Papers\Papers;
use App\Papers\MyReportPaper;

public function boot(): void
{
    Papers::register([
        MyReportPaper::class,
    ]);
}
```

### Access Control

[](#access-control)

By default, access to Papers is restricted in non-local environments. Define a Gate to control who can view them:

```
use Illuminate\Support\Facades\Gate;
use App\Models\User;

public function boot(): void
{
    Gate::define('viewPapers', function (User $user) {
        return in_array($user->email, [
            'admin@example.com',
        ]);
    });
}
```

Creating a Paper
----------------

[](#creating-a-paper)

A Paper class extends `Schrojf\Papers\Paper` and defines its sections as callable functions. Each section returns content such as strings, arrays, or component instances like `TableContent` or `DataPanelContent`.

Here’s a full example:

```
