PHPackages                             tinyrocket/magento - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. tinyrocket/magento

AbandonedArchivedLibrary[API Development](/categories/api)

tinyrocket/magento
==================

A simple Magento Integration using SOAP v1 and v2

3517613[4 issues](https://github.com/TinyRocket/laravel-magento-integration/issues)PHP

Since Sep 29Pushed 11y ago8 watchersCompare

[ Source](https://github.com/TinyRocket/laravel-magento-integration)[ Packagist](https://packagist.org/packages/tinyrocket/magento)[ RSS](/packages/tinyrocket-magento/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Magento SOAP Integration for Laravel
====================================

[](#magento-soap-integration-for-laravel)

A simple and somewhat intuitive package for managing and interacting with the Magento SOAP Api. Compatible with Laravel 4 and Magneto SOAP v1 &amp; v2.

[![Build Status](https://camo.githubusercontent.com/cf64ec49e0ef13444e56f906024c7c6e245837e40f6ed706f83dea776975ae95/68747470733a2f2f7472617669732d63692e6f72672f54696e79526f636b65742f6c61726176656c2d6d6167656e746f2d696e746567726174696f6e2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/TinyRocket/laravel-magento-integration) [![Latest Stable Version](https://camo.githubusercontent.com/e1651902cfd5637db1e752632f5f3801e2c84c8f31ff07be2413fd2f52d3ede4/68747470733a2f2f706f7365722e707567782e6f72672f74696e79726f636b65742f6d6167656e746f2f762f737461626c652e737667)](https://packagist.org/packages/tinyrocket/magento) [![Total Downloads](https://camo.githubusercontent.com/17604683cebc4ff1625489fac36d85f35a781a36d746288d23536414b352d2b5/68747470733a2f2f706f7365722e707567782e6f72672f74696e79726f636b65742f6d6167656e746f2f646f776e6c6f6164732e737667)](https://packagist.org/packages/tinyrocket/magento) [![Latest Unstable Version](https://camo.githubusercontent.com/0511d112c8e94cafe526fc6635388704699f538530ae4fad9d51f41d9b1951a0/68747470733a2f2f706f7365722e707567782e6f72672f74696e79726f636b65742f6d6167656e746f2f762f756e737461626c652e737667)](https://packagist.org/packages/tinyrocket/magento) [![License](https://camo.githubusercontent.com/5f75487034ae166137b17f3c42f97a5aef949fca27f343644081c0978db001aa/68747470733a2f2f706f7365722e707567782e6f72672f74696e79726f636b65742f6d6167656e746f2f6c6963656e73652e737667)](https://packagist.org/packages/tinyrocket/magento)

> **Note:** This package is still in the beta phase of development. I'd advise against using to test against a production Magento application. This package is for Laravel 4, if you're looking for a Laravel 3 version of this package, checkout [MatteoCastiglioni's bundle](https://github.com/MatteoCastiglioni/magentoapi)

### Installation

[](#installation)

To install via composer, add the following to your requirements

```
"require": {
	...
	"tinyrocket/magento": "1.0.*"
	...
},

```

**Note:** You may need to change your **minimum-stability** to **dev**

### Configuration

[](#configuration)

Add the following to your Laravel Application configuration (app/config/app.php)

To your **providers** array

```
'providers' => array(
    ...
	'Tinyrocket\Magento\MagentoServiceProvider',
	...
),

```

and to your **aliases** array

```
'aliases' => array(
    ...
	'Magento' => 'Tinyrocket\Magento\Facades\Magento',
	...
),

```

Publish the the package configuration file by running the following in CLI

```
php artisan config:publish tinyrocket/magento

```

#### Setting up the SOAP connections

[](#setting-up-the-soap-connections)

The quickest way to get started with Magento integration is to add your connection(s) to the newly published configuration file. The file can be found in

```
app/config/packages/tinyrocket/magento/config.php

```

There is no limit to the amount of connections that you can save, but you should set a default configuration to handle fallbacks. Inside of the configuration file, set the following with your Magento SOAP information.

**Note:** Use your store's base URL, not the URL for the SOAP endpoint. (e.g.  rather than )

```
'connections' => [
    ...
	'default'	=>	[
		'site_url'	=>	'http://magentohost',
		'user'		=>	'',
		'key'		=>	'',
		'version'   =>  'v2'
	],
	...
]

```

The first parameter defines the name of the connection and should be unique. The API version is optional and will default to v2 for all connections, unless set otherwise.

\##Usage

An exhaustive list of possible methods is available on the [Magento Website](http://www.magentocommerce.com/api/soap/)

There are two basic methods used to interact with the SOAP Api

For **SOAP v2**

```
Magento::call()->someSoapRequest($requestParams)

// Example
Magento::call()->customerCustomerList()

```

For **SOAP v1**

```
Magento::get('some.method', array($requestParams))

//Example
Magento::get('customer.list')

```

Alternatively, you can call methods directly for **SOAP v2** requests

```
Magento::someSoapRequest($requestParams)

// Example
 $customerParams = array(
	'email' 		=> 'customer@example.org',
	'firstname' 	=> 'Dough',
	'lastname' 		=> 'Deeks',
	'password' 		=> 'password',
	'website_id' 	=> 1,
	'store_id' 		=> 1,
	'group_id' 		=> 1
);
$customerId = Magento::customerCustomerCreate($customerParams)

```

\###Working with the results

To make working with the SOAP API slightly more intuitive, some request results are returned as data objects and collections, inspired by **Varien\_Object** and **Varien\_Object\_Collection** classes in Magento. These classes allow for the calling of information with some basic methods.

\####Objects Collections For SOAP responses that return a group of items, results are returned as object collections containing individual objects. These collections have four basic methods.

**getCollection()** - Returns all items as a group of objects

**getCount()** - Returns number of items in the collection

**getFirstItem()** - Returns the first response item

**getLastItem()** - Returns the last response item

```
foreach ( Magento::salesOrderList()->getCollection() as $order ) {
    // Do stuff
}

```

---

\####Objects For SOAP responses that return a single array item, or when iterating through a response collection, the MagnetoObject is used. This object comes with a couple methods that should be familiar to a Magento developer

**getData(optional $key)** - Either returns all of an objects values or a single value that matches the provided key.

**getId()** - Returns the primary key of a given response object

Like a **Varien\_Object** you can also use a magic getter to pull information from an object. For example, you can use the following two methods to return the incrementId of an order object

```
foreach ( Magento::salesOrderList()->getCollection() as $order ) {

    // with data
    echo $order->getData('increment_id')

    // with magic getter
    echo $order->getIncrementId()
}

```

---

\####Single Results For SOAP responses that return a single value or boolean, results are returned as a string/integer/boolean

```
// will return an integer
echo Magento::customerCustomerCreate($customerParams)

```

\###Working multiple connections You have the option to use connections to multiple Magento websites. This can be done by either adding a secondary connection to the package configuration or by creating a connection on the fly. Connections are stored, so once registered, you can continue to use that connection by referencing it's unique identifier or the newly created connection object.

To create a connection on the fly

```
$connection = Magento::createConnection($name, $url, $user, $key, $version)

```

To use a stored connection

```
// SOAP v2
$orders = Magento::call($connection)->salesOrderList();
$orders = Magento::call('unique_identifier')->salesOrderList();

// SOAP v1
$customers = Magento::get('customers.list', null, $connection)
$customers = Magento::get('customers.list', null, 'unique_identifier')

```

To register a connection programmatically

```
Magento::createAndRegisterConnection($name, $url, $user, $key, $version)

```

To see a list of available connections

```
print_r( Magento::getAvailableConnections() )

```

**Setting a primary connection**Inherently, unless explicitly passed to a SOAP call, the default connection found in the configuration file is used when making all calls. To change which connection is used by default, you can use

```
Magento::setPrimaryConnection('unique_identifier')

// Then use for subsequent calls
Magento::salesOrderList()

```

To see the currently primary connection

```
echo Magento::getPrimaryConnection()

```

To remove a connection from memory

```
Magento::unregister('unique_identifier')

```

To create a temporary connection

```
$connection = Magento::createAndForgetConnection($name, $url, $user, $key, $version)

// Then reference it in the call
$orders = Magento::call($connection)->salesOrderList()

```

\###Helpers

**Getting Magic Getters for an object/collection**Though used just to return data, you can use the following to get a list of available functions for a given object or collection

```
// For a collection
echo Magento::call()->customerCustomerList()->getFunctions();

// For an object
$customer->getFunctions();

```

This will return something like

```
Array
(
    [0] => getCustomerId
    [1] => getCreatedAt
    [2] => getUpdatedAt
    [3] => getStoreId
    [4] => getWebsiteId
    [5] => getCreatedIn
    [6] => getEmail
    [7] => getFirstname
    [8] => getLastname
    [9] => getGroupId
    [10] => getDob
    [11] => getPasswordHash
)

```

**Test your SOAP connection**Returns a boolean by default, but can return headers by flagging the second parameter as true.

```
var_dump( Magento::testConnection('unique_identifier', $returnHeaders = false) )

```

**Get Magento Version**Returns the build version of either the default connection or the one passed

```
// Example return Community 1.9.0.0
var_dump( Magento::getMagentoVersion(optional $connection) )

```

\###XML Support Currently, there is no support of XML request and responses. But, it's planned for future releases.

\###WS-I Compliance Mode Currently, there is no way enforce WS-I Compliance Mode.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a7bb07e532f805386a5d8d1775ccec06b7c93f5ebd598fbd23cdd5e853119343?d=identicon)[TinyRocket](/maintainers/TinyRocket)

### Embed Badge

![Health badge](/badges/tinyrocket-magento/health.svg)

```
[![Health](https://phpackages.com/badges/tinyrocket-magento/health.svg)](https://phpackages.com/packages/tinyrocket-magento)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[facebook/php-business-sdk

PHP SDK for Facebook Business

90821.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

74513.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

265103.1M454](/packages/google-gax)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
