Download the PHP package vxm/laravel-mobile-first without Composer
On this page you can find all versions of the php package vxm/laravel-mobile-first. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vxm/laravel-mobile-first
More information about vxm/laravel-mobile-first
Files in vxm/laravel-mobile-first
Package laravel-mobile-first
Short Description Support implement mobile-first principle for your Laravel application.
License MIT
Homepage https://github.com/vuongxuongminh/laravel-mobile-first
Informations about the package laravel-mobile-first
Laravel Mobile First
About it
A package support you implementing mobile-first principle base on Jenssegers Agent.
Installation
Require Laravel Mobile First using Composer:
After require, you need to publish the config-file with:
This is the contents of the published config file:
Usage
This package provides you two features:
- Redirect end-user to mobile site url if they not using desktop device.
- Auto switch view to compatible view (sub-view)
Mobile redirect
You need setup your mobile site url in your mobilefirst
config file:
Now add middleware:
Auto switch view
This feature is disabled by default, you need to enabled it in mobilefirst
config file:
It is a way to replace a set of views with another by user device without the need of touching the original view rendering code.
You can use it to systematically change the look and feel of an application depend on user device.
For example, when call view('about')
, you will be rendering the view file resources/views/about.blade.php
, if user use mobile device, the view file resources/views/mobile/about.blade.php
will be rendered, instead.
The device_sub_dirs
governs how view files should be replaced by user device.
It takes an array of key-value pairs, where the keys are the device types and the values are the corresponding view sub-directory.
The replacement is based on user device: if user device match with any key in the device_sub_dirs
array, a view path will be added with the corresponding sub-directory value.
Using the above configuration example, when user using mobile device because it match the key mobile, a view path will be added mobile look like resources/views/mobile/about.blade.php
.
Of course you can change the value or add more cases:
The above configuration if user using ios, the view path will be added apple
.