2017 © Pedro Peláez
 

package baseify-php-sdk

Baseify API - PHP SDK

image

tmarois/baseify-php-sdk

Baseify API - PHP SDK

  • Tuesday, July 24, 2018
  • by timothymarois
  • Repository
  • 1 Watchers
  • 1 Stars
  • 32 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

baseify-php-sdk

This SDK is used for the baseify.com Publisher API for Product Search., (*1)

Installation:

Composer to install package., (*2)

Use composer require tmarois/baseify-php-sdk, (*3)

Configuration Usage:

$baseify = (new Baseify('YOUR_CLIENT_KEY'))->productSearch([
    'domain' => 'yourdomain.com'
]);

// set the users IP address
// This allows the API to return the proper results
$baseify->user()->set('ip',$testIp);

// set the user agent (also a requirement)
$baseify->user()->set('ua',$testAgent);

// how many items do you want to limit this request to
$baseify->filter()->set('limit',10);

Query Usage:

// send in the query request
$results = $baseify->query('car chargers');

// get a list of all the products returned
$products = $results->getProducts();

// count how many products are returned
$products->count();

// get a list of the stores in the results
$stores = $results->getStores();

// get a list of the brands in the results
$brands = $results->getBrands();

// get a list of the brands in the results
$categories = $results->getCategories();

Results:

Using the query() method returns Baseify\Api\ProductSearch\Results, (*4)

Method Description
getRaw() Get the raw JSON results
getStatus() Get the status of results
getMessage() Get the status message of results
getEndpoint() Get the full API URL Request
getStores() Get an array of stores (pulled from products)
getBrands() Get an array of brands (pulled from products)
getCategories() Get an array of categories (pulled from products)
getCategoryWithIds() Get the categories and the category ids
getProducts() Get products returned as a Collection object
toArray() Get an array of entire results

Product Collection:

The getProducts() returns results using the Collection object from basephp\support, here are the highlighted useful methods., (*5)

Method Description
all() Get all items in collection
has($key) Returns true if the parameter is defined.
get($key, $default) Get the specified value.
first() Get the first item from the collection.
last() Get the last item from the collection.
shuffle() Shuffle the items in the collection.
slice() Slice the underlying collection array.
reverse() Reverse items order.
remove($key) Removes a item.
count() Returns the number of items.
take($limit) Take the first or last {$limit} items.
map($callable) Run a map over each of the items.
pluck($value, $key) Get the values of a given key.
random($number) Get one or a number of items randomly.
sort($callable) Sort through each item with a callback..
filter($callable) Run a filter over each of the items.
where($key, $operator, $value) Filter items by the given key value pair.
whereIn($key, $values) Filter items by the given key value pair.
push($value) Push an item onto the end of the collection.
pull($value) Get and remove an item from the collection.
put($key, $value) Put an item in the collection by key.
toArray() Get the collection of items as a plain array.
toJson() Get the collection of items as JSON.

Resources:

Contributions

Anyone can contribute to the baseify-php-sdk project. Please do so by posting issues when you've found something that is unexpected or sending a pull request for improvements., (*6)

License

baseify-php-sdk is open-sourced software licensed under the MIT license., (*7)

The Versions

24/07 2018

dev-master

9999999-dev https://github.com/tmarois/baseify-php-sdk

Baseify API - PHP SDK

  Sources   Download

The Requires

 

The Development Requires

by Timothy Marois

baseify

24/07 2018

1.0.x-dev

1.0.9999999.9999999-dev https://github.com/tmarois/baseify-php-sdk

Baseify API - PHP SDK

  Sources   Download

The Requires

 

The Development Requires

by Timothy Marois

baseify

24/07 2018
24/07 2018
23/07 2018