diego1araujo / titleasy by diego1araujo

Build titles like a charm in Laravel 5
452
4
3
Package Data
Maintainer Username: diego1araujo
Maintainer Contact: diego77araujo@gmail.com (Diego Araujo)
Package Create Date: 2013-09-25
Package Last Update: 2017-07-25
Home Page:
Language: PHP
License: BSD-2-Clause
Last Refreshed: 2024-12-22 03:10:13
Package Statistics
Total Downloads: 452
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 4
Total Watchers: 3
Total Forks: 1
Total Open Issues: 0

Build Status

Titleasy - Build titles like a charm.

This package is an HTML title generator for Laravel 4.

For Laravel 5, use the 1.0 branch!

Installation

Edit composer.json file to require this package.

"require": {
	...
	"diego1araujo/titleasy": "dev-master"
}

Next, run the composer update command:

composer update

Open up app/config/app.php

Find the providers key and add a new item to the array

'Diego1araujo\Titleasy\ServiceProvider',

Find the aliases key and add a new item to the array

'Title' => 'Diego1araujo\Titleasy\Facade',

Methods

put  - add titles. return: void
last - retrieve last title added. return: string
get  - build the title. return: string. there are 3 params:
		- site name
		- delimiter (default: -)
		- reverse mode (default: false)

Usage

Starting

Title::get('My Website') // Output: My Website

Adding a title

Title::put('Users Page')
Title::get('My Website') // Output: My Website - Users Page

Changing the delimiter (Set a second parameter on get)

Title::put('Users Page')
Title::get('My Website', '|') // Output: My Website | Users Page

Switching to reverse order (Set a third parameter on get as TRUE)

Title::put('Users Page')
Title::get('My Website', '|', TRUE) // Output: Users Page | My Website

Multiple titles

Title::put('Users Page')
Title::put('Editing')
// or just:
Title::put('Users Page', 'Editing')

Retrieving the last title added

Title::last()

Out of Laravel

Require via composer

composer require diego1araujo/titleasy

When asked for a version, choose:

dev-master

Create a index.php like:

<?php
require_once 'vendor/autoload.php';

use Diego1araujo\Titleasy\Titleasy as Title;

Title::put('Users Page');
echo Title::get('My Website');

NOTE: This job was based on mywizz's library. Credits goes to him, also.