PHP code example of editllc / php-montage

1. Go to this page and download the library: Download editllc/php-montage 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/ */

    

editllc / php-montage example snippets




use Montage\Montage;

//get an authenticated instance of the Montage wrapper
$montage = (new Montage('yourSubdomain'))->auth($username, $password);

//or if you have a token already
$montage = new Montage('yourSubdomain', $token);

//get a MontageSchema instance 
$moviesSchema = $montage->schema('movies');

//or, magically...
$movieSchema = $montage->movies(); 

//Documents is an iterable object of the schema documents
foreach ($moviesSchema->documents as $movie) {
    echo sprintf("Movie Title: %s\n", $movie->title);
}

$movieSchema->documents->filter(['title__icontains' => 'Jurassic']); //case insensitive title search
$movieSchema->documents->limit(5);
$movieSchema->documents->orderBy('title', 'desc');
$movieSchema->documents->offset(5);

foreach ($moviesSchema->documents as $movie) {
    echo sprintf("Movie Title: %s\n", $movie->title);
}