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.

1.5.4 2018-01-09 23:33 UTC

README

Build Status

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

Contributors

License