PHPackages                             krubio/perfect-theme - 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. krubio/perfect-theme

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

krubio/perfect-theme
====================

Theme Switcher

13HTML

Since May 31Pushed 1y ago1 watchersCompare

[ Source](https://github.com/benanamen/perfect-theme)[ Packagist](https://packagist.org/packages/krubio/perfect-theme)[ RSS](/packages/krubio-perfect-theme/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![codecov](https://camo.githubusercontent.com/a46368a6c92b5962411a790ffd311b126f3dbaa9e9748c43394a2001bb48cbd3/68747470733a2f2f636f6465636f762e696f2f67682f62656e616e616d656e2f706572666563742d7468656d652f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d725930496c65574a4e57)](https://codecov.io/gh/benanamen/perfect-theme)[![Build](https://github.com/benanamen/perfect-theme/actions/workflows/build.yml/badge.svg)](https://github.com/benanamen/perfect-theme/actions/workflows/build.yml)

[![Coverage](https://camo.githubusercontent.com/8102dc90a423bfe3d9f4b1f47209f57ea3cc3e6fb0b2acf266ab5577acf76025/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d7468656d65266d65747269633d636f766572616765)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-theme)[![Reliability Rating](https://camo.githubusercontent.com/c9e7160d7aa6a61fd596f40ca5e7fb88765ae44624353ce24afb8964f634f51f/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d7468656d65266d65747269633d72656c696162696c6974795f726174696e67)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-theme)[![Security Rating](https://camo.githubusercontent.com/34cf0a2526a84641cb1e25a89e50707bdd4fdea8844329321dbb4ef0345a0be8/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d7468656d65266d65747269633d73656375726974795f726174696e67)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-theme)[![Maintainability Rating](https://camo.githubusercontent.com/0cdf067eec0cb3382e515f7ba4e7ac05791be6ad3422a96686a5f8bda51dc647/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d7468656d65266d65747269633d7371616c655f726174696e67)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-theme)[![Bugs](https://camo.githubusercontent.com/af06c909a96e5d6b39c1817b0a4651f34b49895309221ecbfa60937e24b8f8b4/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d7468656d65266d65747269633d62756773)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-theme)[![Vulnerabilities](https://camo.githubusercontent.com/1f411cb7fa26164479bc809c637d3f571e1caa523cb1c9f9caeab577a9feec7e/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d7468656d65266d65747269633d76756c6e65726162696c6974696573)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-theme)[![Quality Gate Status](https://camo.githubusercontent.com/9280bd6b5d1a289825d305d3f595651c4e1b6f0bd0cabde048bad113db7ded5e/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d7468656d65266d65747269633d616c6572745f737461747573)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-theme)[![Duplicated Lines (%)](https://camo.githubusercontent.com/8418eaa68f4a7428dafebc0196907b178b39ac91ac6e863daac4bb739330847c/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d7468656d65266d65747269633d6475706c6963617465645f6c696e65735f64656e73697479)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-theme)[![Technical Debt](https://camo.githubusercontent.com/75648b60ac6e611f30d53bf5251be4027e2c78d3073cd0d2b966cadda4a4a4fe/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d7468656d65266d65747269633d7371616c655f696e646578)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-theme)[![Code Smells](https://camo.githubusercontent.com/983c6fb26713c99dbf39a9d0f97e2a8b24a6ea891bec16df53c613cd63e9e8f9/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d62656e616e616d656e5f706572666563742d7468656d65266d65747269633d636f64655f736d656c6c73)](https://sonarcloud.io/summary/new_code?id=benanamen_perfect-theme)

ThemeSelector
-------------

[](#themeselector)

### Introduction

[](#introduction)

The `ThemeSelector` class provides functionality for managing themes in a web application. It allows users to select a theme from a list of available themes, and it can also set a default theme if the user's selected theme is not available.

### Getting Started

[](#getting-started)

To use the `ThemeSelector` class, you need to instantiate it:

```
$themeSelector = new ThemeSelector();
```

### Setting the Theme

[](#setting-the-theme)

To set the user's selected theme, you can use the `setTheme` method:

```
$themeSelector->setTheme('cosmo');
```

If the selected theme is not available, the default theme will be used instead.

### Getting the Theme

[](#getting-the-theme)

To get the current theme, you can use the `getTheme` method:

```
$theme = $themeSelector->getTheme();
```

### Rendering the Theme Selector

[](#rendering-the-theme-selector)

To render the theme selector dropdown, you can use the `renderSelector` method:

```
$output = $themeSelector->renderSelector();
```

This will return the HTML markup for the theme selector dropdown.

CookieHandler
-------------

[](#cookiehandler)

### Introduction

[](#introduction-1)

The `CookieHandler` trait provides functionality for handling cookies in a web application.

### Setting a Cookie

[](#setting-a-cookie)

To set a cookie, you can use the `set` method:

```
$expiry = time() + 3600; // set expiry to one hour from now
$path = '/';
CookieHandler::set('my_cookie', 'my_value', $expiry, $path);
```

This will set a cookie named `my_cookie` with a value of `my_value`, an expiry time of one hour from now, and a path of `/`.

### Getting a Cookie

[](#getting-a-cookie)

To get the value of a cookie, you can use the `get` method:

```
$value = CookieHandler::get('my_cookie');
```

This will return the value of the cookie named `my_cookie`, or `null` if the cookie does not exist.

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity18

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/92efcd3e8d87753dc819d970a254160b7ea8a60de6a127e7f93acada576b49c5?d=identicon)[benanamen](/maintainers/benanamen)

---

Top Contributors

[![benanamen](https://avatars.githubusercontent.com/u/1039435?v=4)](https://github.com/benanamen "benanamen (9 commits)")

### Embed Badge

![Health badge](/badges/krubio-perfect-theme/health.svg)

```
[![Health](https://phpackages.com/badges/krubio-perfect-theme/health.svg)](https://phpackages.com/packages/krubio-perfect-theme)
```

PHPackages © 2026

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