Download the PHP package weebly/cloud-client without Composer

On this page you can find all versions of the php package weebly/cloud-client. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package cloud-client

Weebly Cloud API Library: PHP

Installation

Composer

composer require weebly/cloud-client

Other

Download the latest release and include init.php in your code.

require_once("path/to/cloud-client-php/src/init.php");

Setup and Authentication

API calls are authenticated through a public key and a hash of your request and secret key. You can create and manage your API keys in the settings section of the Weebly Cloud Admin.

WeeblyCloud\CloudClient::setKeys(YOUR_API_KEY, YOUR_API_SECRET);

You must set your public and secret key before making any calls to the API.

Examples

Typical use case: create a user and site, get a login link

Printing the name of all pages in a site matching the query "help"

or

Errors

If a request fails, the CloudClient throws a CloudException. A list of error codes can be found in the API documentation. The exception can be caught as folllows:

Resources

The library provides classes that represent API resources. These resources can be mutable, meaning their properties can be changed, and deletable.

Common methods:

Instantiating Resources

For example, to create an object representing a site with id $site_id and owned by $user_id:

$site = new WeeblyCloud\Site($user_id, $site_id);

All resource constructors have two optional parameters, initialize (true by default) and existing. If initialize is set to false, the properties of the object are not retrieved from the database when the object is instantiated. Instead, existing is used to set the object's properties. This can be used to reduce unecessary API calls when chaining calls.

Examples

Retrieve all the sites of a user without getting that user's information:

$sites = (new WeeblyCloud\User($user_id, false))->listSites();

Retrieve information about a site's store:

$store = (new WeeblyCloud\Site($user_id, $site_id))->getStore();

Retrieve a list of products in the site's store:

$site = new WeeblyCloud\Site($_ENV['USER_ID'], $_ENV['SITE_ID'], true);
$store = $site->getStore;
$products = $site->listProducts();
// Get quantity of products in the store
$numberOfProductsInStore = $site->getProductCount();
while ($product = $products->next()) {
    print($product->getProperty("name")."\n");
}

Iterable Results

Methods beginning with list return a CloudList. Use the next function or a foreach loop to iterate through the list. For example:

This would list the titles of all sites belonging to a given user.

Resource Types

In addition to this readme, each resource class has phpdoc documentation. To view that documentation, install phpDocumentor and run these commands in the cloud-client-php directory:

phpdoc -d ./src/WeeblyCloud
open output/namespaces/WeeblyCloud.html

Account

API Documentation

A mutable representation of your Cloud Admin account, specified by your API keys. To construct:

$account = new WeeblyCloud\Account();

Blog

API Documentation

A respresentation of a blog. To construct:

$blog = new WeeblyCloud\Blog($user_id, $site_id, $blog_id);

BlogPost

API Documentation

A mutable and deletable respresentation of a blog post. To construct:

$blog_post = new WeeblyCloud\BlogPost($user_id, $site_id, $blog_id, $post_id);

There are no BlogPost specific methods.

Form

API Documentation

A respresentation of a form. To construct:

$form = new WeeblyCloud\Form($user_id, $site_id, $form_id);

FormEntry

API Documentation

A respresentation of a form entry. To construct:

$form_entry = new WeeblyCloud\FormEntry($user_id, $site_id, $form_id, $entry_id);

There are no FormEntry specific methods.

Group

API Documentation

A mutable and deletable respresentation of a group. To construct:

$group = new WeeblyCloud\Group($user_id, $site_id, $group_id);

Page

API Documentation

A mutable respresentation of a page. To construct:

$page = new WeeblyCloud\Page($user_id, $site_id, $page_id);

There are no Page specific methods.

Plan

API Documentation

A respresentation of a plan. To construct:

$plan = new WeeblyCloud\Plan($plan_id);

There are no Plan specific methods.

Member

API Documentation

A mutable and deletable respresentation of a member. To construct:

$member = new WeeblyCloud\Member($user_id, $site_id, $member_id);

Product

API Documentation

A mutable and deletable respresentation of a site. To construct:

To construct:

$product = new WeeblyCloud\Product($user_id, $site_id, $product_id);

Site

API Documentation

A mutable and deletable respresentation of a site. To construct:

To construct:

$site = new WeeblyCloud\Site($user_id, $site_id);

Store

API Documentation

A mutable respresentation of a site. To construct:

To construct:

$store = new WeeblyCloud\Store($user_id, $site_id);

User

API Documentation

A mutable respresentation of a WeeblyCloud user. To construct:

$user = new WeeblyCloud\User($user_id);

Making Raw API Calls

Not every resource has a cooresponding resource class. It is possible to make a raw API call using a CloudClient object.

Using that client, call get, post, put, patch, or delete. All client request methods take a url as their first argument. post, patch, and put take an optional hash map of data that will be sent in the request body. get takes an optional hash map whose values will be used in the query string of the request.

The url must not include a leading slash.

Request examples

Get cloud admin account account
Update a page title
Get all sites for a user (with search parameters)

Handling Responses

All requests return a CloudResponse object or throw a CloudException. The JSON returned by the request can be accessed through the response's body property.

Pagination example

If the endpoint supports pagination, the next and previous pages of results can be retrieved with the getPreviousPage() and getNextPage() methods. If there is no next or previous page, those methods return null.

Get all of a user's sites, 10 sites per page.


All versions of cloud-client with dependencies

PHP Build Version
Package Version
Requires php Version ^5.4.0 || ^7.0
ext-curl Version *
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package weebly/cloud-client contains the following files

Loading the files please wait ....