PHPackages                             hdgarau/common - 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. hdgarau/common

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

hdgarau/common
==============

Common Functions

v1.0.2(4y ago)0341PHP

Since Sep 5Pushed 4y ago1 watchersCompare

[ Source](https://github.com/hdgarau/common)[ Packagist](https://packagist.org/packages/hdgarau/common)[ RSS](/packages/hdgarau-common/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (2)Dependencies (1)Versions (5)Used By (1)

common
======

[](#common)

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

[](#description)

Library with basics Classes.

Index
-----

[](#index)

1. Date
2. Parse
3. Functions

1. Date
-------

[](#1-date)

### Period

[](#period)

#### Description

[](#description-1)

Is a class with static methods. That one return a date (type \\Datetime) from a date and period indicated.
Some options are:

- days
- weeks
- months
- years
- weekBegin (first previous Monday)
- weekDay (first previous \[day\])
- monthLastDay
- getByCode (ConstantClassCode + ' ' + param)

#### Examples

[](#examples)

```
Period::days(-3)->format('Y-m-d')); //three days ago
Period::setDefault('1985-02-15');
Period::getByCode('D 5')->format('Y-m-d'); //1985-02-20

```

### Parse

[](#parse)

#### Description

[](#description-2)

Parse a string to object by a token then It generates Entity and EntityGroup objects. Each entityGroup object has a property level. that indicates if it is contained for the previous one or a child has finished. For example if we parse de parenthesis for "That is a test (just a simple (very) test) to do":

- EntityGroup (level:0) - entities:
    - Entity (content:"That is a test")
    - EntityGroup (level:1) - entities:
        - Entity (content:"just a simple")
        - EntityGroup: (level:2) - entities:
            - Entity: (content:"very")
        - Entity: (content:"test")
    - Entity: (content:"to do")

You can return to build the original string with casting (string)

#### Example

[](#example)

```
        $str = '( this is a ( Complex (test) Resource ) and (his (1(2,2b(3)2c)1 ) brother) something)';
        $oParsedParenthesis = StringParse::strToParsedGroupParenthesis($str );
        print_r($oParsedParenthesis); //print object
        echo (string) $oParsedParenthesis; // reverse to string

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

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 ~79 days

Total

3

Last Release

1555d ago

### Community

Maintainers

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

---

Top Contributors

[![hdgarau](https://avatars.githubusercontent.com/u/5494311?v=4)](https://github.com/hdgarau "hdgarau (26 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/hdgarau-common/health.svg)

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

###  Alternatives

[cagartner/correios-consulta

Package para pesquisa de serviços de busca por cep, calculo de frete e etc, diretamente nos serviços dos Correios.

159301.8k](/packages/cagartner-correios-consulta)

PHPackages © 2026

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