PHPackages                             s25/promo - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. s25/promo

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

s25/promo
=========

package for connecting promo to the project

1.0.1(3y ago)07.5k↓50%proprietaryPHPPHP &gt;=8.0.0

Since Sep 1Pushed 3y ago1 watchersCompare

[ Source](https://github.com/shop25/promo)[ Packagist](https://packagist.org/packages/s25/promo)[ RSS](/packages/s25-promo/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Description
-----------

[](#description)

Package for connecting promotion to the project.

Install
-------

[](#install)

```
composer require s25/promo
```

Usage
-----

[](#usage)

1. Create the PromotionClient extended from base class

```
use S25\Promo;

class PromotionClient extends BasePromotionsClient {

   public function getHeaderPlace(): PromoPlace|null
   {
        return $this->getPlace('header');
   }

    public function getCategoryPlace(array $conditions = []): PromoPlace|null
    {
        return $this->getPlace('header', $conditions);
    }
}
```

2. Create the promo client facade

```
use S25\Promo;

class PromotionClientFacade
{
    private static PromotionsClient|null $instance;
    private static bool $isSet = false;

    public static function getInstance(): PromotionsClient|null
    {
        if (!self::$isSet) {
            try{
                self::$isSet = true;

                $options = new PromotionsClientOptions('host', 'project', 'ru');

                self::$instance = new PromotionsClient(new \GuzzleHttp\Client(), $options);
            } catch (Exception) {
                self::$instance = null;
            }
        }

        return self::$instance;
    }
}
```

3. Create template

```
