PHPackages                             campaigningbureau/critical-laravel-routes - 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. campaigningbureau/critical-laravel-routes

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

campaigningbureau/critical-laravel-routes
=========================================

Automatically create and link Critical CSS for static routes in Laravel projects

v1.3.0(1y ago)01.9k[1 issues](https://github.com/CampaigningBureau/critical-laravel-routes/issues)MITPHPPHP ^8.1

Since Jan 26Pushed 1y ago4 watchersCompare

[ Source](https://github.com/CampaigningBureau/critical-laravel-routes)[ Packagist](https://packagist.org/packages/campaigningbureau/critical-laravel-routes)[ RSS](/packages/campaigningbureau-critical-laravel-routes/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (7)Used By (0)

Critical Laravel Routes
=======================

[](#critical-laravel-routes)

Automatically create and link Critical CSS for static routes.

Supports Laravel 7.\*

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

[](#installation)

Just require the package via composer:

```
composer require campaigningbureau/critical-laravel-routes

```

The package gets automatically discovered by Laravel.

Usage
-----

[](#usage)

1. All static routes, that should use critical css, need to be named and have a `critical` attribute set to `true`:

    ```
    Route::get('/', ['as' => 'index', 'uses' => 'ViewController@index', 'critical' => true]);
    ```
2. Generate the JSON that contains all critical routes:

    ```
    php artisan critical-urls:generate
    ```
3. The generated file needs to be required in the webpack.mix.js and set as `urls` when creating the critical css:

    ```
    // urls that need to be passed for critical css
    const criticalUrls = require('./critical-routes.json');
    ...
    mix.criticalCss({
        enabled: mix.inProduction(),
        paths: {
            base: 'http://your-website.com',
            templates: 'public/css/'
        },
        urls: criticalUrls,
        options: {
            minify: true,
        },
    });
    ```

    When generating the css, one css file per defined route is created and saved.
4. Automatically import the content of the critical css file (if it exists for the route) in the blade template as inline styles:

    ```
    {!! \CriticalLaravelRoutes::inlineCriticalCss() !!}

    ```

    Alternatively, the critical css file can be linked with:

    ```
    {!! \CriticalLaravelRoutes::linkCriticalCss() !!}

    ```

    This can be used safely vor every existing route, so it is best to put it in the base layout. If no critical css file is found for a route, nothing is displayed.

Configuration
-------------

[](#configuration)

The config can be changed by publishing the configuration file:

```
$ php artisan vendor:publish --provider="CampaigningBureau\CriticalLaravelRoutes\CriticalLaravelRoutesServiceProvider"
```

It is possible to configure the name of the generated JSON file and the suffix for the critical css filess.

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 66.7% of commits — single point of failure

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 ~341 days

Total

5

Last Release

567d ago

PHP version history (3 changes)v1.0PHP ^7.2

v1.2.0PHP ^7.2||^8.0

v1.3.0PHP ^8.1

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3008376?v=4)[Campaigning Bureau](/maintainers/campaigningbureau)[@CampaigningBureau](https://github.com/CampaigningBureau)

---

Top Contributors

[![stefanschindler](https://avatars.githubusercontent.com/u/786048?v=4)](https://github.com/stefanschindler "stefanschindler (6 commits)")[![DmitrySidorenkoShim](https://avatars.githubusercontent.com/u/8822805?v=4)](https://github.com/DmitrySidorenkoShim "DmitrySidorenkoShim (3 commits)")

### Embed Badge

![Health badge](/badges/campaigningbureau-critical-laravel-routes/health.svg)

```
[![Health](https://phpackages.com/badges/campaigningbureau-critical-laravel-routes/health.svg)](https://phpackages.com/packages/campaigningbureau-critical-laravel-routes)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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