PHPackages                             zero1/magento2-release-library - 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. zero1/magento2-release-library

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

zero1/magento2-release-library
==============================

1.1.1(11mo ago)55.3k1GPL-3.0-or-laterPHP

Since Apr 22Pushed 11mo ago2 watchersCompare

[ Source](https://github.com/zero1limited/magento2-ReleaseLibrary)[ Packagist](https://packagist.org/packages/zero1/magento2-release-library)[ RSS](/packages/zero1-magento2-release-library/feed)WikiDiscussions master Synced 5d ago

READMEChangelog (10)Dependencies (2)Versions (17)Used By (0)

magento2-ReleaseLibrary
=======================

[](#magento2-releaselibrary)

A module to provided easy to use functions in updgrade/install scripts

Usage
=====

[](#usage)

To use the functions in your setup or install script add the util class to your objects constructor

```
/** @var \Zero1\ReleaseLibrary\Utility **/
protected $setupUtility;

public function __construct(
    \Zero1\ReleaseLibrary\Utility $setupUtility
){
    $this->setupUtility = $setupUtility;
}
```

You will then be able to call `$this->setupUtility`.

Functions
=========

[](#functions)

Create / Update a custom variable
---------------------------------

[](#create--update-a-custom-variable)

```
$this->setupUtility->createCustomVariable(
    'Variable Code,
    'Variable Name',
    'HTML Value',
    'Plain Value'
);
```

You can also supply a 5th argument:

- `true` - update if variable if one with the same code already exists
- `false` - throw a EntityAlreadyExistsException if a variable with the same code exists

Move a category
---------------

[](#move-a-category)

```
$this->setupUtility->moveCategory(
    CATEGORY_ID_TO_MOVE
    MOVE_TO_THIS_CATEGORY_ID,
);
```

You can also supply a 3rd argument "after", if you would like the moved category to be placed after a specific category.

Create CMS Blocks
-----------------

[](#create-cms-blocks)

This allows you to create a number of CMS Blocks without needing to add the html into your setup script.

### Configuration

[](#configuration)

Before being able to do this you must create another module or use your current release module. This module must contain the directory `block_source`

### Example

[](#example)

In this example I have a module called "My\_ReleaseModule" which contains:

```
My_ReleaseModule/
    block_source/
        1.0.0/
            a-new-custom-block.html
        1.0.1/
            custom-block.html
            promo-block.html

```

```
// configure setup utility to use my module
$this->setupUtility->setSourceModule('My_ReleaseModule);

// create all the blocks in `1.0.1`
$this->setupUtility->createBlocksFromDir(
    $this->setupUtility->getBlockSourceDirectory().'/1.0.1/'
);
```

This will result in two cms blocks being created 1.

- name: custom block
- id: custom-block

2.

- name: promo block
- id: promo-block

Create CMS Pages
----------------

[](#create-cms-pages)

This allows you to create a number of CMS Pages without needing to add the html into your setup script.

### Configuration

[](#configuration-1)

Before being able to do this you must create another module or use your current release module. This module must contain the directory `page_source`

### Example

[](#example-1)

In this example I have a module called "My\_ReleaseModule" which contains:

```
My_ReleaseModule/
    page_source/
        1.0.0/
            a-new-cms-page.html
        1.0.1/
            custom-page.html
            contact-us.html

```

```
// configure setup utility to use my module
$this->setupUtility->setSourceModule('My_ReleaseModule);

// create all the pages in `1.0.1`
$this->setupUtility->createPagesFromDir(
    $this->setupUtility->getPageSourceDirectory().'/1.0.1/'
);
```

This will result in two cms pages being created 1.

- name: custom page
- id: custom-page

2.

- name: contact us
- id: contact-us

Set Config
----------

[](#set-config)

Update / set config values

### Example 1 - set single value

[](#example-1---set-single-value)

```
$this->setupUtility->setConfig(
    [['design/head/demonotice', 1]],
    'default',
    0
);
```

### Example 2 - set multiple values for default scope

[](#example-2---set-multiple-values-for-default-scope)

```
$this->setupUtility->setConfig([
    ['design/head/demonotice', 1],
    ['web/cookie/cookie_httponly', 1]
]);
```

### Example 3 - set multiple values for multiple scopes

[](#example-3---set-multiple-values-for-multiple-scopes)

```
$this->setupUtility->setConfig([
    ['design/head/demonotice', 1], // will be set at default
    ['web/cookie/cookie_httponly', 1] // will be set at default
    ['web/cookie/cookie_path', '/', 'stores', 1], // will be set for store 1
    ['web/cookie/cookie_path', '/', 'stores', 2], // will be set for store 2
]);
```

Update Email Templates
----------------------

[](#update-email-templates)

Update email template with ID of `$templateId`, with content from the file at `$newTemplateContentPath`.

```
$this->setupUtility->updateEmailTemplate($templateId, function($template){
    /** @var \Magento\Email\Model\BackendTemplate $template */
    $template->setTemplateText(
        file_get_contents($newTemplateContentPath)
    );
    return $template;
});

```

You can update as many/few things as you like.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance51

Moderate activity, may be stable

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 75.7% 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 ~124 days

Recently: every ~430 days

Total

16

Last Release

344d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0b08c35b603becab270a53db6ec969f48be0c353a20ee2985bb1a8ec5a9b64e9?d=identicon)[zero1](/maintainers/zero1)

---

Top Contributors

[![arronmoss](https://avatars.githubusercontent.com/u/2673943?v=4)](https://github.com/arronmoss "arronmoss (28 commits)")[![adamzero1](https://avatars.githubusercontent.com/u/6369163?v=4)](https://github.com/adamzero1 "adamzero1 (9 commits)")

---

Tags

magentoinstallmagento 2setup

### Embed Badge

![Health badge](/badges/zero1-magento2-release-library/health.svg)

```
[![Health](https://phpackages.com/badges/zero1-magento2-release-library/health.svg)](https://phpackages.com/packages/zero1-magento2-release-library)
```

###  Alternatives

[yireo/magento2-webp2

Magento 2 module to add WebP support to the Magento frontend

2091.2M7](/packages/yireo-magento2-webp2)[tig/postnl-magento2

TIG Magento 2 PostNL extension

58544.2k4](/packages/tig-postnl-magento2)[magepal/magento2-customeraccountlinksmanager

Customer Account Links Manager for Magento2 allows you to quickly and easily remove unwanted links from customer account dashboard

4084.9k](/packages/magepal-magento2-customeraccountlinksmanager)[elgentos/magento2-product-duplicate-images-remove

Magento 2 find duplicate product images from your product list and from this list you can easily remove them by running a command

201.4k](/packages/elgentos-magento2-product-duplicate-images-remove)[mage2pro/currency-format

The «Price Format» extension for Magento 2

215.9k](/packages/mage2pro-currency-format)

PHPackages © 2026

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