Skip to content
A small Laravel package to load in Google Fonts.
Branch: master
Clone or download
Latest commit e4a08fd May 26, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
config init May 26, 2019
src init May 26, 2019
.styleci.yml init May 26, 2019
changelog.md init May 26, 2019
composer.json Fixed licence typo May 26, 2019
contributing.md init May 26, 2019
license.md
phpunit.xml init May 26, 2019
readme.md init May 26, 2019

readme.md

Google Fonts Loader

A small Laravel package to load google fonts into your application.

Installation

1 - Dependency

The first step is using composer to install the package and automatically update your composer.json file, you can do this by running:

composer require rossmcneil/googlefontsloader

Note: If you are using Laravel 5.5, the steps 2 and 3, for providers and aliases, are unnecessaries. GoogleFontsLoader supports Laravel new Package Discovery.

2 - Provider

You need to update your application configuration in order to register the package so it can be loaded by Laravel, just update your config/app.php file adding the following code at the end of your 'providers' section:

config/app.php

// file START ommited
    'providers' => [
        // other providers ommited
        RossMcNeil\GoogleFontsLoader\Providers\GoogleFontsLoaderServiceProvider::class,
    ],
// file END ommited

3 - Facade

In order to use the GoogleFontsLoader facade, you need to register it on the config/app.php file, you can do that the following way:

// file START ommited
    'aliases' => [
        'GoogleFontsLoader' => RossMcNeil\GoogleFontsLoader\Facades\GoogleFontsLoader::class,
    ],
// file END ommited

4 Configuration

Publish config

In your terminal type

php artisan vendor:publish

or

php artisan vendor:publish --provider="RossMcNeil\GoogleFontsLoader\Providers\GoogleFontsLoaderServiceProvider"

In googlefontsloader.php configuration file you can determine the properties of the default values and some behaviors.

googlefontsloader.php

fonts

  • Is an array of fonts you wish to load in. display
  • Is the value used for the font-display setting.

Usage

In Your View

<html>
<head>
	{!! GoogleFontsLoader::load() !!}

    <!-- You may also pass the fonts into the load method as an array. This will override the config settings. -->
	{!! GoogleFontsLoader::load([
        'Open Sans:400,700'
    ]) !!}
</head>
<body>

</body>
</html>

Change log

Please see the changelog for more information on what has changed recently.

Contributing

Please see contributing.md for details and a todolist.

Security

If you discover any security related issues, please email ross@digizu.co.uk instead of using the issue tracker.

Credits

License

Please see the license file for more information.

You can’t perform that action at this time.