2017 © Pedro Peláez
 

library laravel-mobile-detect

Instant mobile detection access directly from within Blade templates.

image

riverskies/laravel-mobile-detect

Instant mobile detection access directly from within Blade templates.

  • Thursday, April 26, 2018
  • by barnabaskecskes
  • Repository
  • 7 Watchers
  • 67 Stars
  • 42,105 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 9 Forks
  • 0 Open issues
  • 8 Versions
  • 22 % Grown

The README.md

Laravel Mobile Detect

A package that enables you to use device detection right in your Blade templates. (Utilises the well-known, constantly updated PHP mobile detection library.), (*1)

When would you use this package?

Responsive CSS may help to make content in the browser look nice on different devices but it won't help you serve responsive content from your backend (at least not the easy way). This can have a really bad knock-on effect on the user experience (have you ever waited for a large image to load while having a bad connection on your mobile?). This package will make it a breeze to serve device-specific content right from your back-end., (*2)

How does this package work?

The package implements various Blade directives that you can use to serve different content from your Blade template for different device types., (*3)

Installation

Install the package through composer:, (*4)

$ composer require riverskies/laravel-mobile-detect

Laravel 5.4 or earlier

Add the service provider to your config/app.php file:, (*5)

Riverskies\Laravel\MobileDetect\MobileDetectServiceProvider::class

Optionally, you can add an alias as well if you'd like to use the underlying instance anywhere else (or have access to all the functions):, (*6)

'MobileDetect' => Riverskies\Laravel\MobileDetect\Facades\MobileDetect::class

Usage

Use the new Blade directives in your template files:, (*7)

@desktop
    <img src="/path/to/high-definition/image"/>
@elsedesktop
    <img src="/path/to/handheld-optimised/image"/>
@enddesktop

NOTE You might have to run php artisan view:clear to have the new Blade directives take effect!, (*8)

Available directives

@desktop, @elsedesktop, @enddesktop - for destkop devices, (*9)

@handheld, @elsehandheld, @endhandheld - for non-desktop (mobile and tablet) devices, (*10)

@tablet, @elsetablet, @endtablet - for tablet devices, (*11)

@nottablet, @elsenottablet, @endnottablet - for non-tablet (desktop or mobile) devices, (*12)

@mobile, @elsemobile, @endmobile - for mobile devices, (*13)

@notmobile, @elsenotmobile, @endnotmobile - for non-mobile (desktop or tablet) devices, (*14)

@ios, @elseios, @endios - for iOS platforms, (*15)

@android, @elseandroid, @endandroid - for Android platforms, (*16)

The usage of @else... directives are optional., (*17)

The Versions

26/04 2018

dev-master

9999999-dev

Instant mobile detection access directly from within Blade templates.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Barnabas Kecskes

laravel blade mobile detection

02/09 2017

1.3

1.3.0.0

Instant mobile detection access directly from within Blade templates.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Barnabas Kecskes

laravel blade mobile detection

06/04 2017

v1.2.2

1.2.2.0

Instant mobile detection access directly from within Blade templates.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Barnabas Kecskes

laravel blade mobile detection

05/04 2017

v1.2.1

1.2.1.0

Instant mobile detection access directly from within Blade templates.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Barnabas Kecskes

laravel blade mobile detection

21/03 2017

v1.1.2

1.1.2.0

Instant mobile detection access directly from within Blade templates.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Barnabas Kecskes

laravel blade mobile detection

21/03 2017

v1.2.0

1.2.0.0

Instant mobile detection access directly from within Blade templates.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Barnabas Kecskes

laravel blade mobile detection

12/03 2017

v1.1

1.1.0.0

Instant mobile detection access directly from within Blade templates.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Barnabas Kecskes

laravel blade mobile detection

21/05 2016

1.0.0

1.0.0.0

Instant mobile detection access directly from within Blade templates.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Barnabas Kecskes

laravel blade mobile detection