Giter VIP home page Giter VIP logo

laravel-amp's Introduction

Lavavel AMP (Accelerated Mobile Pages)

This package makes it easy to integrate AMP in your Laravel projects. By using the new Route::amp() notation.

Installation

You can install the package via composer:

composer require wearejust/laravel-amp

Register the service provider in your app.php

// app.php
'providers' => [
    ...
    Just\Amp\Laravel\AmpServiceProvider::class,
],
'aliases' => [
    ...
    'AmpRouter' => Just\Amp\Laravel\AmpRouteFacade::class,
]

And register the custom Route::amp() notation in your RouteServiceProvider.php.

/// app/Providers/RouteServiceProvider.php
use AmpRouter;

...
public function boot(Router $router)
{
    AmpRouter::registerMacros();

    parent::boot($router);
}

Usage

//route.php
Route::amp('url-of-my-route', ['as' => 'my-route', 'uses' => 'PageController@text']);

There well be two routes registered. One with '/url-of-my-route', and one prefixed with the config value you specify in the config file such as googleamp. The logic for both routes is the same, but the view that's being rendered for the amp route affixed the the config value you specify in the config file (view-affix). In your view, include the amp::tag file. This will match the AMP route (if exists) and put an link to the amp content in your HTML.

Changelog

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.

laravel-amp's People

Contributors

ceesvanegmond avatar ricardo avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.