2017 © Pedro Peláez
 

library laravel_sdk

SQweb package for Laravel users

image

sqweb/laravel_sdk

SQweb package for Laravel users

  • Tuesday, January 9, 2018
  • by sqweb
  • Repository
  • 0 Watchers
  • 0 Stars
  • 310 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 18 Versions
  • 2 % Grown

The README.md

Multipass Laravel Package

Build Status Latest Stable Version Dependency Status, (*1)

This package allows you to easily integrate SQweb on your Laravel powered website., (*2)

Requirements

This SDK has been tested with PHP 5.5 and greater., (*3)

We are unable to provide official support for earlier versions. For more information about end of life PHP branches, see this page., (*4)

Install

This package is intended for websites powered by Laravel, and advanced integrations., (*5)

If you're using WordPress, we've made it easy for you. Download the SQweb plugin directly from WordPress.org, or check out the source here., (*6)

Using Composer

  1. In your project root, execute composer require mltpss/laravel-sdk;, (*7)

  2. Now, go to config/app.php and add this line to your providers array:, (*8)

    Sqweb\Laravel_sdk\SqwebServiceProvider::class,
    
  3. Type php artisan vendor:publish at the root of your project to create the configuration file., (*9)

  4. In .env, paste the following configuration and set the variable SQW_ID_SITE with your website ID and the variable SQW_SITENAME with the name you want to show on the large multipass button., (*10)

    SQW_ID_SITE=YOUR_WEBSITE_ID
    SQW_SITENAME=YOUR_WEBSITE_NAME
    

For additional settings, see "Options" below., (*11)

Usage

The SDK is really simple to use. Here's how to:, (*12)

1. Tagging your pages

This function outputs the SQweb JavaScript tag. Insert it before the closing </body> tag in your HTML., (*13)

{{ $sqweb->script() }}

If you previously had a SQweb JavaScript tag, make sure to remove it to avoid any conflicts., (*14)

2. Checking the credits of your subscribers

This function checks if the user has credits, so that you can disable ads and/or unlock premium content., (*15)

Use it like this:, (*16)

@if ($sqweb->checkCredits())
    // CONTENT
@else
    // ADS
@endif

3. a) Showing the Multipass button

Finally, use this code to get the Multipass button on your pages:, (*17)

{{ $sqweb->button() }}

We have differents sizes for the button, to use them, pass a string to the function e.g:, (*18)

{{ $sqweb->button('tiny') }}
{{ $sqweb->button('slim') }}
{{ $sqweb->button('large') }}

Example Buttons, (*19)

3. b) Customizing the Multipass button

If you want to customize our different type of button, put the following in your .env of in the sqweb config file. For instance: SQW_LOGIN=Hello world Will show Hello world instead of Premium with Multipass on the regular button for logged out visitors., (*20)

Button Model Logged in Logged out
Tiny SQW_CONNECTED_TINY SQW_LOGIN_TINY
Regular SQW_CONNECTED SQW_LOGIN
Large - before black dot N / A SQW_BTN_UNLIMITED
Large - after black dot N / A SQW_BTN_NOADS
Large connected SQW_CONNECTED_S N / A

4. More functions

Display a "Support us" message for your users

/**
 * Display a support block.
 */

function supportBlock() {   }
``

For instance:

```php
{!! $sqweb->supportBlock !!}

Will display the block., (*21)

Display a locking div for your users

/**
 * Display a locking block.
 */

function lockingBlock() {   }
``

For instance:

```php
{!! $sqweb->lockingBlock !!}

We recommand you to use it in combination with our filter functions, like this:, (*22)

@if($sqweb->waitToDisplay('2016-09-15', 2))
    // The content here will appear the 2016-09-17, 2 days after the publication date for non paying users.
@else
    // Here you can put content that free users will see before the content above is available for all.
    // {!! $sqweb->lockingBlock !!}
@end

Display only a part of your content to non premium users

/**
 * Put opacity to your text
 * Returns the text with opcaity style.
 * @param text, which is your text.
 * @param int percent which is the percent of your text you want to show.
 * @return string
 */
    public function transparent($text, $percent = 100) { ... }

Example:, (*23)

{!! $sqweb->transparent('one two three four', 50) !!}

Will display for free users:, (*24)

one two

Display your content later for non paying users

    /**
     * Display your premium content at a later date to non-paying users.
     * @param  string  $date  When to publish the content on your site. It must be an ISO format(YYYY-MM-DD).
     * @param  integer $wait  Days to wait before showing this content to free users.
     * @return bool
     */
    public function waitToDisplay($date, $wait = 0) { ... }

Example:, (*25)

@if($sqweb->waitToDisplay('2016-09-15', 2))
    // The content here will appear the 2016-09-17, 2 days after the publication date for non paying users.
@else
    // Here you can put content that free users will see before the content above is available for all.
@end

Limit the number of articles free users can read per day

    /**
     * Limit the number of articles free users can read per day.
     * @param $limitation int The number of articles a free user can see.
     * @return bool
     */
    public function limitArticle($limitation = 0) { ... }

Example if I want to display only 5 articles to free users:, (*26)

@if ($sqweb->limitArticle(5) == true)
    echo "This is my article";
@else
    echo "Sorry, you reached the limit of pages you can see today, come back tomorrow or subscribe to Multipass to get unlimited articles !";
@endif

Options

Unless otherwise noted, these options default to false. You can set them in your .env file., (*27)

Option Description
SQW_DEBUG Output various messages to the browser console while the plugin executes.
SQW_DWIDE Set to false to only enable SQweb on the current domain. Defaults to true.
SQW_LANG We support these locales: en_US, en_GB and fr_FR.
SQW_AUTOLOGIN Enable or disable our autologin feature. Defaults to true.

Contributing

We welcome contributions and improvements., (*28)

Coding Style

All PHP code must conform to the PSR2 Standard., (*29)

Builds and Releases

See RELEASE.md., (*30)

Bugs and Security Vulnerabilities

If you encounter any bug or unexpected behavior, you can either report it on Github using the bug tracker, or via email at hello@sqweb.com. We will be in touch as soon as possible., (*31)

If you discover a security vulnerability within SQweb or this plugin, please e-mail security@sqweb.com. Vulnerabilities will be promptly addressed., (*32)

License

Copyright (C) 2018 – SQweb, (*33)

This program is free software ; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation ; either version 3 of the License, or any later version., (*34)

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY ; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details, (*35)

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/., (*36)

The Versions

09/01 2018

dev-master

9999999-dev

SQweb package for Laravel users

  Sources   Download

The Requires

  • ext-curl *
  • php >= 5.5.9

 

The Development Requires

by Pierre Lavaux
by Mathieu Darrigade
by Matthieu Borde
by Nicolas Verdonck

laravel sdk sqweb

09/01 2018

dev-MT2_update1.3.0

dev-MT2_update1.3.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.5.9
  • ext-curl *

 

The Development Requires

by Pierre Lavaux
by Mathieu Darrigade
by Matthieu Borde
by Nicolas Verdonck

laravel sdk sqweb

09/01 2018

v1.3.0

1.3.0.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.5.9
  • ext-curl *

 

The Development Requires

by Pierre Lavaux
by Mathieu Darrigade
by Matthieu Borde
by Nicolas Verdonck

laravel sdk sqweb

09/01 2018

dev-blarg

dev-blarg

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.5.9
  • ext-curl *

 

The Development Requires

by Pierre Lavaux
by Mathieu Darrigade
by Matthieu Borde
by Nicolas Verdonck

laravel sdk sqweb

20/11 2017

v1.2.6

1.2.6.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.5.9
  • ext-curl *

 

The Development Requires

by Pierre Lavaux
by Mathieu Darrigade
by Matthieu Borde
by Nicolas Verdonck

laravel sdk sqweb

07/11 2017

v1.2.5

1.2.5.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.5.9
  • ext-curl *

 

The Development Requires

by Pierre Lavaux
by Mathieu Darrigade
by Matthieu Borde
by Nicolas Verdonck

laravel sdk sqweb

02/08 2017

v1.2.4

1.2.4.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.5.9
  • ext-curl *

 

The Development Requires

by Pierre Lavaux
by Mathieu Darrigade
by Matthieu Borde
by Nicolas Verdonck

laravel sdk sqweb

05/07 2017

v1.2.3

1.2.3.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.5.9
  • ext-curl *

 

The Development Requires

by Pierre Lavaux
by Mathieu Darrigade
by Matthieu Borde
by Nicolas Verdonck

laravel sdk sqweb

05/07 2017

v1.2.3.x-dev

1.2.3.9999999-dev

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.5.9
  • ext-curl *

 

The Development Requires

by Pierre Lavaux
by Mathieu Darrigade
by Matthieu Borde
by Nicolas Verdonck

laravel sdk sqweb

19/06 2017

v1.2.2

1.2.2.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.5.9
  • ext-curl *

 

The Development Requires

by Pierre Lavaux
by Mathieu Darrigade
by Matthieu Borde
by Nicolas Verdonck

laravel sdk sqweb

16/05 2017

v1.2.1

1.2.1.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.5.9
  • ext-curl *

 

The Development Requires

by Pierre Lavaux
by Mathieu Darrigade
by Matthieu Borde
by Nicolas Verdonck

laravel sdk sqweb

16/05 2017

v1.2.0

1.2.0.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.5.9
  • ext-curl *

 

The Development Requires

by Pierre Lavaux
by Mathieu Darrigade
by Matthieu Borde
by Nicolas Verdonck

laravel sdk sqweb

16/11 2016

v1.1.3

1.1.3.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.2.0
  • ext-curl *

 

The Development Requires

by Mathieu Darrigade
by Matthieu Borde

laravel sdk sqweb

31/10 2016

v1.1.2

1.1.2.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.2.0
  • ext-curl *

 

The Development Requires

by Mathieu Darrigade
by Matthieu Borde

laravel sdk sqweb

11/10 2016

v1.1.1

1.1.1.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.2.0
  • ext-curl *

 

The Development Requires

by Mathieu Darrigade
by Matthieu Borde

laravel sdk sqweb

30/09 2016

v1.1.0

1.1.0.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.2.0
  • ext-curl *

 

The Development Requires

by Mathieu Darrigade
by Matthieu Borde

laravel sdk sqweb

08/04 2016

v1.0.1

1.0.1.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.2.0
  • ext-curl *

 

The Development Requires

by Mathieu Darrigade

laravel sdk sqweb

07/04 2016

v1.0.0

1.0.0.0

SQweb package for Laravel users

  Sources   Download

The Requires

  • php >= 5.2.0
  • ext-curl *

 

The Development Requires

by Mathieu Darrigade

laravel sdk sqweb