PHPackages                             szajens/pece - 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. szajens/pece

ActiveLibrary

szajens/pece
============

Pece routing for Codeigniter 4 - This library modifies the host for the URL helper and URI Service

1.0(3y ago)06MITPHP

Since May 22Pushed 3y ago1 watchersCompare

[ Source](https://github.com/szajens/pece)[ Packagist](https://packagist.org/packages/szajens/pece)[ RSS](/packages/szajens-pece/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Pece routing for Codeigniter 4
==============================

[](#pece-routing-for-codeigniter-4)

### This library modifies the host for the URL helper and URI Service

[](#this-library-modifies-the-host-for-the-url-helper-and-uri-service)

How to use in Routes:
---------------------

[](#how-to-use-in-routes)

There are new options in CI4 routing, you can use all or some

Example:

```
$routes->get('/test/(:any)', 'Test::index/$1', ['pSubdomain'=> '[a-z]+', 'pDomain'=>'ci.loc', 'pSSL' => null, 'pSubhost' => false]);

```

#### Limit to subdomain:

[](#limit-to-subdomain)

When the subdomain option is present, the system will restrict the routes to only be available on that sub-domain. The route will only be matched if the subdomain is the one the application is being viewed through:

Regular Expressions If you prefer you can use regular expressions to define your subdomain rules. Any valid regular expression is allowed

Example:

```
// Limit to media.example.com
$routes->add('from', 'to', ['pSubdomain' => 'media']); or
$routes->add('from', 'to', ['pSubdomain' => '[a-z]+']);

```

#### Limit to Domain

[](#limit-to-domain)

You can restrict groups of routes to function only in certain domain of your application by passing the “pDomain” option along with the desired domain to allow it on as part of the options array: Example:

```
$routes->get('from', 'to', ['pDomain' => 'example.com']);

```

#### Limit to SSL

[](#limit-to-ssl)

If you need limiting to https use true, to http set false or not limiting set null Example:

```
$routes->get('from', 'to', ['pSSL' => true]);

```

#### Setting subdomain+domain as host

[](#setting-subdomaindomain-as-host)

if you want to use subdomain and domain as host in CI4 set this option as true or false with otherwise Example:

```
$routes->get('from', 'to', ['pSubhost' => true]);

```

How to use in your app e.g. controller:
---------------------------------------

[](#how-to-use-in-your-app-eg-controller)

Change host from subdomain to domain: `Services::pece()->setDomainInCI();`

> xxx.host.com =&gt; host.com

Change host from domain to subdomain (if the request is from a subdomain, reverse `setDomainInCI()`): `Services::pece()->setSubdomainInCI();`

> host.com =&gt; xxx.host.com

Change subdomain in host: `Services::pece()->changeSubdomainInCI('new.sub.domain');`

> host.com =&gt; new.sub.domain.host.com
> abc.host.com =&gt; new.sub.domain.host.com

Add to subdomain in host `Services::pece()->addSubdomainInCI('new.sub.domain');`

> host.com =&gt; new.sub.domain.host.com
> abc.host.com =&gt; new.sub.abc.domain.host.com

Other methods:

```
Services::pece()->
getDomain(): - return request domain
getSubdomain(): - request subdomain
getScheme(): - request scheme e.g. 'https://' or 'http://'

```

Instalation:
------------

[](#instalation)

- Composer

```
composer require szajens/pece

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

Unknown

Total

1

Last Release

1455d ago

### Community

Maintainers

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

---

Top Contributors

[![szajens](https://avatars.githubusercontent.com/u/65465848?v=4)](https://github.com/szajens "szajens (8 commits)")

### Embed Badge

![Health badge](/badges/szajens-pece/health.svg)

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

PHPackages © 2026

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