leadpages / pages
A package to allow you to easily integrate Leadpages pages into your PHP project
This package's canonical repository appears to be gone and the package has been frozen as a result.
Installs: 545
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:HTML
Requires
- php: >=5.4.0
- guzzlehttp/guzzle: ~5 < 6
- leadpages/leadpages-auth: *
Requires (Dev)
- phpunit/phpunit: 4.8
This package is not auto-updated.
Last update: 2022-02-02 14:36:10 UTC
README
Synopsis
Leadpages Pages is meant to make it simple to get your integration into Leadpages off the ground quickly.
- Abstracts away the required methods to call Leadpages to retrieve a list of all your pages and get specific pages.
- Built in minimal storage abstraction to allow Leadpages extensions to follow known sets of standards.
- Uses Guzzle5 to allow a consistent Http abstraction layer across all platforms. Guzzle5 chosen for PHP 5.4 support
Code Example
<?php
use GuzzleHttp\Client;
use WordPressLeadpagesLogin; //class made from the Leadpages-Auth example
use Leadpages\Pages\LeadpagesPages;
class LeadpagesController
{
public function __construct(LeadpagesAuthentication $leadpagesAuthentication, Client $client)
{
$this->leadpagesAuthentication = $leadpagesAuthentication;
$this->client = $client;
$this->leadpagesPages = new LeadpagesPages($this->client, $this->leadpagesAuthentication);
}
/**
* Get an array of all the pages you have in your account
*/
public function getAllPages()
{
$pages = $this->leadpagesPages->getAllUserPages();
return $pages;
}
/**
* Get an array of all the pages you have in your account
*/
public function getPageHtml()
{
//page id returned from $pages array above
$page = $this->leadpagesPages->getSinglePageDownloadUrl('5638830484881408');
$page = json_decode($page['response'], true);
$pageUrl = $page['url'];
$html = file_get_contents($pageUrl);
echo $html;
}
}
Installation
Package can be installed via Composer
#install composer
curl -sS https://getcomposer.org/installer | php
Run composer to require the package
php composer.phar require leadpages/leadpages-auth
Next insure that you are included the composer autoloader into your project. Package uses PSR-4 Autoloading
require 'vendor/autoload.php';
API Reference
Docs to come
Tests
Tests are run via PHPUnit