PHP Classes

PHP MoySklad Client: Access the MoySklad API using ORM like objects

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 124 All time: 9,460 This week: 524Up
Version License PHP version Categories
moysklad-client 0.1MIT/X Consortium ...5.4PHP 5, E-Commerce, Web services
Description 

Author

This package is specific mainly for applications used in Russian Federation Russian Federation .

This package can access the MoySklad API using ORM like objects.

It provides a set of classes that send HTTP requests to the MoySklad API and perform several types of operations with all types of entities like some ORM libraries perform.

It can find or load objects, set and get the object properties, save or delete objects, etc..

The package comes with MoySklad entity objects for companies, customers, orders, payments, stock items, etc..

Picture of Oleksii Mylotskyi
  Performance   Level  
Innovation award
Innovation award
Nominee: 1x

 

Example

<?php
namespace Zf2ClientMoysklad;

require_once
__DIR__.'/_config.php';

use
Zf2ClientMoysklad\Entity\Good;
use
Zf2ClientMoysklad\Entity\PurchaseOrder;
use
Zf2ClientMoysklad\Repository\BasicRepository;

global
$sm;

/* @var $entityManager EntityManager */
$entityManager = $sm->get('zf2clientmoysklad_entity_manager');

/*====================== Method for Create purchase orders ==========================*/

$entityToOrder = '1e474a24-5cd7-11e3-00e2-7054d21a8d1e';

/* @var $goodEntity Good */
$goodEntity = $entityManager->find('Zf2ClientMoysklad\Entity\Good', $entityToOrder);

$purchaseOrder = new PurchaseOrder();
$purchaseOrderPosition = new PurchaseOrder\Position();

$entityManager->persist($purchaseOrder);

//Dealer id
$purchaseOrder->setSourceAgentUuid('2678f502-5cc9-11e3-320b-7054d21a8d1e');

//Your organisation id
$purchaseOrder->setTargetAgentUuid('266ce37b-5cc9-11e3-92f6-7054d21a8d1e');

$purchaseOrderPosition->setGoodsUuid($goodEntity->getUuid());
$purchaseOrderPosition->setPriceSum($goodEntity->getPrice());
$purchaseOrderPosition->setPriceSumInCurrency($goodEntity->getPrice());
$purchaseOrderPosition->setQuantity(1000);
$purchaseOrderPosition->setReserve(10);

$purchaseOrder->addOrderPosition($purchaseOrderPosition);

$purchaseOrderPosition = new PurchaseOrder\Position();
$purchaseOrderPosition->setGoodsUuid($goodEntity->getUuid());
$purchaseOrderPosition->setPriceSum($goodEntity->getPrice());
$purchaseOrderPosition->setPriceSumInCurrency($goodEntity->getPrice());
$purchaseOrderPosition->setQuantity(10);
$purchaseOrderPosition->setReserve(1);

$purchaseOrder->addOrderPosition($purchaseOrderPosition);

$entityManager->flush();

/*---------------------------------------------------------------------------------*/


Details

Client for http://www.moysklad.ru/

To setup library you have to had composer.phar. You can download it using this command:

php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"

or you can follow the instructions on http://getcomposer.org/download/

Composer will install all required Zend libraries.

After the composer has been downloaded, you should run it:

chmod a+x composer.phar && ./composer.phar install

or

./composer.phar update

Simple usage examples you can found in demo/ folder.

If your project already includes Zend Framework 2, this module could be installed as Zend Framework 2 module. You should only copy config/zf2clientmoysklad.global.php to your config/autoload and change commented line with your connection credentials.


  Files folder image Files (65)  
File Role Description
Files folder imageconfig (1 file)
Files folder imagedemo (5 files)
Files folder imagesrc (1 directory)
Accessible without login Plain text file .gitignore Data Auxiliary data
Accessible without login Plain text file composer.json Data composer.json
Accessible without login Plain text file LICENSE Lic. LICENSE
Plain text file Module.php Class Module.php
Accessible without login Plain text file README.md Data README.md

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:124
This week:0
All time:9,460
This week:524Up