Download the PHP package moirei/laravel-google-merchant-api without Composer

On this page you can find all versions of the php package moirei/laravel-google-merchant-api. 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 laravel-google-merchant-api

Laravel Google API

A sweet package for managing Google Merchant Center feeds for Google Shopping. This package is prepared to implement the advanced Content API for Merchants.

Example usage:

Features

Updating to 1.1.x

Although backwards compatible, be sure to update your config to be able to use multiple merchants.

Installation

Via composer:

Install the service provider (skip for Laravel>=5.5);

Publish the config

Setup & Authorisation

Usage

Multiple Merchants

From 1.1.0 we can now define multiple merchants and switch between them by simply calling the merchant method from either the Order or Product API class.

Or

Product API

The Google Merchant contents can be queried via the insert, get, delete, and list methods. The product content is contained and handled via the Product class. An instance of this class can be passed directly or resolved in a Closure callback. An instance can be population by

To pass an array or a model, the attributes relationships must be defined in the config.

Insert

The insert method creates a new content, as well as updates an old content if the channel, contentLanguage, targetCountry and offerId are the same.

With arrays:

The attributes values must be defined as per the attributes map in the config.

With Eloquent Models:

The model attributes values must be defined as per the attributes map in the config. For accessing undefined models attributes, use Accessors and custom Model attributes:

For setting custom Product contents (customAttributes), you're probably better off using the custom() method. Likewise for availabilityDate use the availabilityUntil() method.

With Events & Listeners:

The provided event and listener can be setup such that when your application creates or updates a model, the product content is automatically inserted.

To set this up, add the following snippet to your eloquent mode. The product variable can be a model or an array.

Next, define the events relationship in EventServiceProvider.php.

Get & List

The list method calls the get method without any parameters;

So the following should likewise retrieve the product list:

Delete

To set up with the event listener, add the following to your eloquent model:

Then define the relationship in EventServiceProvider.php:

Order API

Please note that these implementations have not been properly tested.

Using the API methods

The acknowledge, cancel, cancelLineItem, rejectReturnLineItem, returnRefundLineItem, get, list methods are currently implemented for interacting with your Google Merchant.

The format for using these methods are standard across the entire package. For example, an order can be acknowledged by

or by

Additionally the listAcknowledged method is provided so one can list acknowledged orders if needed.

Scheduled Scouts

If schedule_orders_check is set as true in the config, the package will regularly scout un-acknowledged orders and will fire a \MOIREI\GoogleMerchantApi\Events\NewOrdersScoutedEvent event. This event includes an array of orders of class \MOIREI\GoogleMerchantApi\Contents\Order. The orders are structured as per the Order Resource.

Example handle in your listener:

Notes:

Sandboxing

The OrderApi class provide a way of calling some of the sandbox operations. Example:

You may use

to use a preset example.

Implemented sandbox actions:

Function Sandbox Action
create createtestorder
advance advancetestorder
cancel createtestorder
createReturn createtestreturn

Commands

This package provides an artisan command for scouting orders.

Handling Errors

Methods that throw exceptions

Exceptions should be handled using the catch function. If making synchronous calls, use the try-catch block. You'd be well advised to always catch requests (and notify your business logic), seeing that Google has a million reasons to deny any request.

Design Notes

Synchronous Calls

All the above are by default asynchronous. To make synchronous calls, use the sync method:

Note: In this case, methods such as insert, get, delete, and list, etc, returns a Guzzle response when called asynchronously (rather than an instance of ProductApi or OrderApi. This means your exception blocks should be wrapped around requests.

Contributing

This package is intended to provide a Laravel solution for the Google Shopping API for Google Merchant. Currently, only the Product Content has been adequately implemented and tested. For orders, refunds, etc., ideas and pull-requests are welcome.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-google-merchant-api with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2|^8.0
illuminate/support Version ~5.0|^6.0|^7.0|^8.0
illuminate/cache Version ~5.0|^6.0|^7.0|^8.0
guzzlehttp/guzzle Version ~5.3|^6.5|^7.0
google/apiclient Version ^2.4
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 moirei/laravel-google-merchant-api contains the following files

Loading the files please wait ....