PHPackages                             andrewdanilov/yii2-site-data - 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. andrewdanilov/yii2-site-data

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

andrewdanilov/yii2-site-data
============================

Component for storing data values in various formats, for displaying them on site

1.0.12(1mo ago)161MITPHPPHP &gt;=5.6.0

Since Nov 5Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/AndrewDanilov/yii2-site-data)[ Packagist](https://packagist.org/packages/andrewdanilov/yii2-site-data)[ RSS](/packages/andrewdanilov-yii2-site-data/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (12)Versions (14)Used By (0)

Site Data
=========

[](#site-data)

Component for storing data values in various formats, for displaying them on site in any places (views, layouts, etc.)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require andrewdanilov/yii2-site-data "~1.0.0"

```

or add

```
"andrewdanilov/yii2-site-data": "~1.0.0"

```

to the `require` section of your `composer.json` file.

Then run db migrations, to create needed tables:

```
php yii migrate --migrationPath=@andrewdanilov/sitedata/migrations

```

Do not forget to run migrations after extension updates too.

Usage
-----

[](#usage)

Configure *module* settings in your `backend` main config:

```
$config = [
	// ...
	'modules' => [
		// ...
		'sitedata' => [
			'class' => 'andrewdanilov\sitedata\Module',
			'access' => ['admin'], // access role for module controllers, optional, default is ['@']
			'uploadBasePath' => '@frontend/web', // optional, default is '@frontend/web'
			'uploadPath' => 'upload/sitedata', // optional, default is 'upload/sitedata'
		],
	],
];
```

Here `access` option allows restricting access to defined roles. Options `basePath` and `uploadPath` defines a path where the different type of images or files will be stored. Module allows you to create, modify and manage various site settings.

Configure *component* settings in your `frontend` main config:

```
$config = [
	// ...
	'components' => [
		// ...
		'siteData' => [
			'class' => 'andrewdanilov\sitedata\components\SiteData',
		],
	],
];
```

Component generally allows you to get site settings values. You can print them in views or use in contorollers and other places. To use needed value in your view, for example, use:

```
$this->title = Yii::$app->siteData->get('seo_title', 'Default seo title');
```

Second param is optional and defines default value if key does not exist.

You can also change values. Changes a permanent and stores into a database:

```
$this->title = Yii::$app->siteData->set('seo_title', 'New seo title');
```

The `siteData` is a component name, configured in `component` section above.

Backend links to manage site data and categories:

```
// list of links for managing values of each category all in one page
$categoryListUrl = Yii::$app->urlManager->createUrl(['/sitedata/manager']);
// manager of all values of category in one page
$categoryDataManagerUrl = Yii::$app->urlManager->createUrl(['/sitedata/manager/edit', 'category_id' => 123]);

// grid for adding/editing/removing data items
$dataGridUrl = Yii::$app->urlManager->createUrl(['/sitedata/data']);
// grid for adding/editing/removing data categories
$categoryGridUrl = Yii::$app->urlManager->createUrl(['/sitedata/category']);
```

Backend menu items:

```
$sitedata_menu_items = [
    ['label' => 'Site Data'],
	['label' => 'Site settings', 'url' => ['/sitedata/manager'], 'icon' => 'cog'],
];

echo \yii\widgets\Menu::widget(['items' => $sitedata_menu_items]);
```

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance89

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~163 days

Recently: every ~381 days

Total

13

Last Release

53d ago

### Community

Maintainers

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

---

Top Contributors

[![AndrewDanilov](https://avatars.githubusercontent.com/u/2826370?v=4)](https://github.com/AndrewDanilov "AndrewDanilov (1 commits)")

---

Tags

Settingsdatayii2extensionstoresite

### Embed Badge

![Health badge](/badges/andrewdanilov-yii2-site-data/health.svg)

```
[![Health](https://phpackages.com/badges/andrewdanilov-yii2-site-data/health.svg)](https://phpackages.com/packages/andrewdanilov-yii2-site-data)
```

###  Alternatives

[lav45/yii2-settings

This extension helps you to easily store and retrieve data for your application.

1615.0k2](/packages/lav45-yii2-settings)[dmstr/yii2-cookie-consent

Yii2 Cookie Consent Widget

1452.6k](/packages/dmstr-yii2-cookie-consent)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

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