laravel-amp

Package that helps you set up AMP (Accelerated Mobile Pages) using Laravel

  • Owner: wearejust/laravel-amp
  • Platform:
  • License:: MIT License
  • Category::
  • Topic:
  • Like:
    0
      Compare:

Github stars Tracking Chart

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.

Main metrics

Overview
Name With Ownerwearejust/laravel-amp
Primary LanguagePHP
Program languagePHP (Language Count: 2)
Platform
License:MIT License
所有者活动
Created At2017-01-25 09:41:41
Pushed At2020-02-05 06:40:06
Last Commit At2018-05-20 23:52:53
Release Count3
Last Release Name1.1.1 (Posted on 2018-05-20 23:52:53)
First Release Name1.0 (Posted on 2017-01-25 10:42:15)
用户参与
Stargazers Count106
Watchers Count7
Fork Count19
Commits Count9
Has Issues Enabled
Issues Count10
Issue Open Count3
Pull Requests Count3
Pull Requests Open Count3
Pull Requests Close Count0
项目设置
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private