PHPackages                             gutocf/page-title - 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. gutocf/page-title

ActiveCakephp-plugin[Utility &amp; Helpers](/categories/utility)

gutocf/page-title
=================

Page Title component for CakePHP 4

1.2.0(2y ago)04.6kMITPHPPHP &gt;=8.1

Since Sep 15Pushed 2y ago1 watchersCompare

[ Source](https://github.com/gutocf/page-title)[ Packagist](https://packagist.org/packages/gutocf/page-title)[ Docs](https://github.com/gutocf/page-title)[ RSS](/packages/gutocf-page-title/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (7)Versions (7)Used By (0)

PageTitleComponent
==================

[](#pagetitlecomponent)

[![Build Status](https://camo.githubusercontent.com/ca864c64a7e741a8dad853e76deeae195486bd0fcc8742ea3c37422c390c4202/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6775746f63662f706167652d7469746c652f63692e796d6c3f6272616e63683d6d6173746572)](https://github.com/gutocf/page-title/actions?query=workflow%3ACI+branch%3Amaster)[![Coverage Status](https://camo.githubusercontent.com/89c1ca0bb8461b6ed821e8f1e7baa568a6cdba855acec27b81714d5519c5b2da/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f6775746f63662f706167652d7469746c652e7376673f7374796c653d666c61742d737175617265)](https://codecov.io/github/gutocf/page-title)[![Latest Stable Version](https://camo.githubusercontent.com/2e171bcb759c79215a61ab59ffc123808beec4f86ea734ae3dff226f7c04fc74/68747470733a2f2f706f7365722e707567782e6f72672f6775746f63662f706167652d7469746c652f762f737461626c652e737667)](https://packagist.org/packages/gutocf/page-title)[![Total Downloads](https://camo.githubusercontent.com/6a28b064e6ddecb62c40da6d85feb8e00b973a116246cd7d524742023bf1e31b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6775746f63662f706167652d7469746c652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gutocf/page-title)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gutocf/page-title)[![PHPStan](https://camo.githubusercontent.com/ec8329f0ec20497dd5501573126668867d62c0b926e60c7813affce74ead5f3c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d4c6576656c253230372d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265266c6f676f3d706870)](https://shields.io/#/)[![Packagist Version](https://camo.githubusercontent.com/d7f6a7b7d7960f5a436dc97fbca7ac8e5cc84c772eb3a4551839a764965a4209/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6775746f63662f706167652d7469746c653f7374796c653d666c61742d737175617265)](https://packagist.org/packages/gutocf/page-title)

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

[](#requirements)

- PHP 8.1+
- CakePHP 5.0+

Note: For using with PHP 8.0 and CakePHP 4.3+ check out version 1.1.1

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

[](#installation)

Install the plugin with composer

```
composer require gutocf/page-title

```

### Plugin load

[](#plugin-load)

```
bin/cake plugin load PageTitle

```

### Component load

[](#component-load)

Load the component in *App\\Controller\\AppController*:

```
$this->loadComponent('Gutocf/PageTitle.PageTitle', [
   'default' => 'MyApp Name', //Default page title - optional, default = null
   'var' => 'var_name_for_views', //Var name to set at view - optional, default = title
   'separator' => ' :: ', //Titles separator - optional, default = ' / '
   'reverseOrder' => true, //Display titles in reverse order of inclusion - optional, default = true
]);
```

You need to load the component in controllers or application's AppController (recomended).

Usage
-----

[](#usage)

To add titles to your page, simply call PageTitle::add method with one or more parameters:

```
$this->PageTitle->add('Articles', 'Add');
```

In *Controller.beforeRender* event, the component will set a variable with *$config\['var'\]* name for use in the views and templates, in this example **Add :: Articles :: MyApp Name** (Or **MyApp Name :: Articles :: Add** if *reverseOrder* option is false). You can set the page title by including this code in the template file *src/templates/default.php*

```
