PHPackages                             afosto/shopctrl - 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. afosto/shopctrl

ActivePackage[API Development](/categories/api)

afosto/shopctrl
===============

Afosto ShopCtrl client

3.0.2(2w ago)21.6k1[1 PRs](https://github.com/afosto/shopctrl/pulls)Apache-2.0PHPCI failing

Since Mar 7Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/afosto/shopctrl)[ Packagist](https://packagist.org/packages/afosto/shopctrl)[ Docs](https://afosto.com)[ RSS](/packages/afosto-shopctrl/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (18)Versions (41)Used By (0)

ShopCtrl
========

[](#shopctrl)

Use this client to convieniently interact with ShopCtrl. This PHP package was developed by Afosto to make a reliable connection between Afosto (Retail Software) and ShopCtrl and provides the following functionality:

- get product data from ShopCtrl
- get order data from ShopCtrl
- create new orders at ShopCtrl

Getting Started
---------------

[](#getting-started)

Simply follow the installation instructions. You will need an account at ShopCtrl that is set up for you to use.

### Prerequisites

[](#prerequisites)

What things you need to install the software and how to install them

- PHP5.5+
- Composer (for installation)

### Installing

[](#installing)

Installing is easy through [Composer](http://www.getcomposer.org/).

```
composer require afosto/shopctrl

```

Examples
--------

[](#examples)

Now, to fetch productdata from ShopCtrl use the following code.

First set some configuration parameters:

```
$settings = new Settings();
```

Define the settings with data obtained from ShopCtrl

```
$settings->shopId = '';
$settings->baseUrl = '';
$settings->username = '';
$settings->password = '';
$settings->cultureId = '';
```

Initialze the application:

```
App::init($settings);
```

### Get a product (from shop context)

[](#get-a-product-from-shop-context)

Run a foreach for ProductSelections to get shop-context-related data and the full product that belongs to the productSelection data

```
foreach (ProductSelection::model()->findAll() as $productSelection) {
    $product = Product::model()->find($productSelection->productId);

    //Use the product data
    dump($productSelection, $product);
}
```

### Generate an order

[](#generate-an-order)

To create an order use the following sample. First set the contact data.

```
$contact = new ContactInfo();
$contact->streetAddress = 'Grondzijl';
$contact->streetAddressNumber = 16;
$contact->city = 'Groningen';
$contact->countryCode = 'NL';
$contact->companyName = 'Afosto SaaS BV';
$contact->eMail = 'peter@afosto.com';
$contact->firstName = 'Peter';
$contact->lastName = 'Bakker';
$contact->postalCode = '9731DG';
$contact->phone = '0507119519';
```

Create an order row.

```
$orderRow = new OrderRow();
$orderRow->orderRowKey = 1;
$orderRow->itemQuantity = 1;
$orderRow->productName = 'TestProduct';
$orderRow->productCode = 'ProductSku';
$orderRow->productDescription = 'Description test product';
$orderRow->itemPriceIncVat = 5.00;
$orderRow->rowDiscountIncVat = 0;
$orderRow->vatperc = 21;
$orderRow->rowTotalIncVat = 5;
```

Create an order.

```
$order = new Order();
$order->id = 0;
$order->shipToContact = $contact;
$order->billToContact = $contact;
$order->date = (new DateTime())->format('Y/m/d H:i:s');
$order->viewModusIncVAT = true;
$order->paymentFeeIncVat = 0;
$order->shippingCostsIncVat = 0;
$order->customerNote = '';
$order->syncSource = 'Afosto';
$order->discountIncVat = 0;
$order->orderRows[] = $orderRow;
$order->orderCode = 'test' . time();
$order->orderTotalIncVat = 5.00;
$order->currencyId = 1;
$order->currencyCode = 'EUR';
```

Set some specific data for the order based on the context / settings

```
$order->paymentTypeId = App::getInstance()->getSettings()->getPaymentTypeId('iDeal');
$order->cultureId = App::getInstance()->getSetting('cultureId');
$order->shopId = App::getInstance()->getSetting('shopId');
$order->mainStatusId = App::getInstance()->getSettings()->getOrderStatus('Active');
```

Now create the order

```
$order->create();
```

Now use the new data (model is updated with the results from the server)

```
$order->id;
```

### Other examples

[](#other-examples)

In the examples directory you will find more examples of this project.

Versioning
----------

[](#versioning)

We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/afosto/dnl/tags).

License
-------

[](#license)

This project is licensed under the Apache License 2.0 - see the [LICENSE.md](LICENSE.md) file for details

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance84

Actively maintained with recent releases

Popularity22

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 77.8% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~97 days

Recently: every ~432 days

Total

36

Last Release

16d ago

Major Versions

0.1.1 → 1.0.02017-04-19

1.4.8 → 2.0.02022-09-28

2.0.0 → 3.0.02022-09-28

### Community

Maintainers

![](https://www.gravatar.com/avatar/9396ebbc376698bfad31f77a42ee333fbc38b559f0ae79ad651ea5ebadbdb8de?d=identicon)[afosto](/maintainers/afosto)

---

Top Contributors

[![bakkerpeter](https://avatars.githubusercontent.com/u/23257320?v=4)](https://github.com/bakkerpeter "bakkerpeter (42 commits)")[![TerraSkye](https://avatars.githubusercontent.com/u/5426161?v=4)](https://github.com/TerraSkye "TerraSkye (12 commits)")

---

Tags

clientafostoshopctrl

### Embed Badge

![Health badge](/badges/afosto-shopctrl/health.svg)

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

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M737](/packages/sylius-sylius)[laravel/framework

The Laravel Framework.

34.8k543.8M20.1k](/packages/laravel-framework)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k51.2M339](/packages/api-platform-core)[shopware/platform

The Shopware e-commerce core

3.4k1.5M3](/packages/shopware-platform)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.6M574](/packages/shopware-core)

PHPackages © 2026

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