PHPackages                             aon2003/laravel-page-titles - 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. aon2003/laravel-page-titles

ActiveLibrary

aon2003/laravel-page-titles
===========================

A simple package that makes it easier to set a page title in a Laravel application.

v1.0.0(3y ago)25[1 PRs](https://github.com/aon4o/laravel-page-titles/pulls)MITPHPPHP ^8.1

Since Oct 30Pushed 2y ago1 watchersCompare

[ Source](https://github.com/aon4o/laravel-page-titles)[ Packagist](https://packagist.org/packages/aon2003/laravel-page-titles)[ Docs](https://github.com/aon2003/laravel-page-titles)[ RSS](/packages/aon2003-laravel-page-titles/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (13)Versions (3)Used By (0)

A simple package that makes it easier to set a page title in a Laravel application.
===================================================================================

[](#a-simple-package-that-makes-it-easier-to-set-a-page-title-in-a-laravel-application)

[![GitHub issues](https://camo.githubusercontent.com/eab2339005bae7c1fae97dab017fad868a42ebba1fd47311ff2b246f81458c0a/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f616f6e323030332f6c61726176656c2d706167652d7469746c6573)](https://github.com/aon2003/laravel-page-titles/issues)[![GitHub forks](https://camo.githubusercontent.com/3a124dc5b86f023a6b162ed60922f30b1c5276d658b44e568cecb845a85e7937/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f666f726b732f616f6e323030332f6c61726176656c2d706167652d7469746c6573)](https://github.com/aon2003/laravel-page-titles/network)[![GitHub stars](https://camo.githubusercontent.com/68bd82fe1b51c0bb7231d1cd28ba072d78756a6af455e0cb1a88f04b5f2d656b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f616f6e323030332f6c61726176656c2d706167652d7469746c6573)](https://github.com/aon2003/laravel-page-titles/stargazers)[![GitHub license](https://camo.githubusercontent.com/84903e1bc1f2bc61f9d661c3eb6865f0dbe6069953c740276afa1662d136e8f5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f616f6e323030332f6c61726176656c2d706167652d7469746c6573)](https://github.com/aon2003/laravel-page-titles/blob/main/LICENSE.md)[![Latest Version on Packagist](https://camo.githubusercontent.com/6846729f98a8342fd8d36e24ca9803b67f239ed200e6d9f055e57f2548f59e84/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616f6e323030332f6c61726176656c2d706167652d7469746c65732e737667)](https://packagist.org/packages/aon2003/laravel-page-titles)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/6e879cfd02c42f9d31a8c0d0aad6b2829970387315e87840f96c9cd427b0a424/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f616f6e323030332f6c61726176656c2d706167652d7469746c65732f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/aon2003/laravel-page-titles/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/170dabd1071e030e735ea00c440578705ce0e89fa55f73626dd7be361a0ab4db/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616f6e323030332f6c61726176656c2d706167652d7469746c65732e737667)](https://packagist.org/packages/aon2003/laravel-page-titles)

This simple package has only one purpose: compacting the job of setting page titles to a single file.

It makes available a global variable `$page_title` in all blade templates and views using a Middleware.

Support us
----------

[](#support-us)

[![Buy Me A Coffee](https://camo.githubusercontent.com/794175f6b50ef8041a39803ee20b99a52ba3d742e482c4a42d7270176eea3816/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f64656661756c742d70696e6b2e706e67)](https://www.buymeacoffee.com/aon4o)

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

[](#installation)

You can install the package via composer:

```
composer require aon2003/laravel-page-titles
```

Next, you need to publish a config file and a language file:

```
php artisan vendor:publish --tag="laravel-page-titles"
```

Lastly, you need to add the custom middleware to your web's middleware group in your `app/Http/Kernel.php` file.

```
'web' => [
    ...
    \Aon2003\PageTitles\Middleware\PageTitles::class,
],
```

Usage
-----

[](#usage)

For the library to work all your routes MUST be named. After the installation a global variable `$page_title` will be available in all blade components. It will contain the name of the current route, which will be used to match a title that you can configure in the translation file: `lang/en/page_titles.php`.

By default, the `page_titles.php` file contains only two default page titles for route names 'index' and 'home'.

```
return [
    'index' => env('APP_NAME', 'Home Page'),
    'home' => env('APP_NAME', 'Home Page'),
];
```

You can add your custom titles by adding lines in this file like this:

```
return [
    ...
    '{route_name}' => '{page_title}',
];
```

Then, in your blade files you should add the following line so the titles are displayed:

```
{{ __($page_title) }}
```

Page titles with Variables
--------------------------

[](#page-titles-with-variables)

If you want to be able to pass variables to your page titles, you should pass them as an array to the view, add numbered placeholders to the title in the language files and change the `` tag in the blade files:

`page_titles.php`:

```
return [
    ...
    'index' => 'Hello, :0!',
];
```

`Controller`:

```
function index() {
    $page_props = ['Alex'];

    return view('{page}', compact('page_props'));
}
```

`{page}.blade.php`:

```
{{ __($page_title, $page_params ?? []) }}
```

The resulting page title should be: `Hello, Alex!`

Translations file name
----------------------

[](#translations-file-name)

If you want, you could use different translation file name. The only thing you should do for it to work is to rename the translation files and change the `translation_file_name` variable in the `page_titles.php` config file to the file name you want to use.

`page_titles.php`:

```
return [
    /*
    |--------------------------------------------------------------------------
    | Translation File Name
    |--------------------------------------------------------------------------
    |
    | Used to find the page titles translations.
    | If you change the translation file name, you MUST change this variable, too!
    |
    */

    'translation_file_name' => 'page-titles',
];
```

Internationalization
--------------------

[](#internationalization)

If your project supports internationalization, you can simply add more `{language_code}/page_title.php` files to your `lang` folder. For more information check out the official [Laravel docs](https://laravel.com/docs/9.x/localization).

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Alex Naida](https://github.com/aon2003)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

1291d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/927acab553d76e07d6d2e2081b7eb6bea657b9550901a036f647b6a7f5af5c66?d=identicon)[aon4o](/maintainers/aon4o)

---

Top Contributors

[![aon4o](https://avatars.githubusercontent.com/u/48474870?v=4)](https://github.com/aon4o "aon4o (5 commits)")[![aon2003](https://avatars.githubusercontent.com/u/154248886?v=4)](https://github.com/aon2003 "aon2003 (3 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laravellaravel-packagepage-titlephpphp8titlelaravelaon2003laravel-page-titles

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/aon2003-laravel-page-titles/health.svg)

```
[![Health](https://phpackages.com/badges/aon2003-laravel-page-titles/health.svg)](https://phpackages.com/packages/aon2003-laravel-page-titles)
```

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[hydrat/filament-table-layout-toggle

Filament plugin adding a toggle button to tables, allowing user to switch between Grid and Table layouts.

6292.3k1](/packages/hydrat-filament-table-layout-toggle)[scalar/laravel

Render your OpenAPI-based API reference

6183.9k2](/packages/scalar-laravel)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)[musahmusah/laravel-multipayment-gateways

A Laravel Package that makes implementation of multiple payment Gateways endpoints and webhooks seamless

852.2k1](/packages/musahmusah-laravel-multipayment-gateways)

PHPackages © 2026

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