PHP code example of mltpss / laravel-sdk

1. Go to this page and download the library: Download mltpss/laravel-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mltpss / laravel-sdk example snippets


    Sqweb\Laravel_sdk\SqwebServiceProvider::class,
    

    SQW_ID_SITE=YOUR_WEBSITE_ID
    SQW_SITENAME=YOUR_WEBSITE_NAME
    

{{ $sqweb->script() }}

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

{{ $sqweb->button() }}

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

/**
 * Display a support block.
 */

function supportBlock() {   }
``

For instance:


/**
 * Display a locking block.
 */

function lockingBlock() {   }
``

For instance:


@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

/**
 * 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) { ... }

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

    /**
     * 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) { ... }

@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.
     * @param $limitation int The number of articles a free user can see.
     * @return bool
     */
    public function limitArticle($limitation = 0) { ... }

@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


Will display the block.

#### Display a locking div for your users

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