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

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

adadgio/common
==============

Adadgio Commons

2.1.0(6y ago)02.6kMITPHPPHP &gt;=5.3

Since Jun 15Pushed 6y ago2 watchersCompare

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

READMEChangelog (10)DependenciesVersions (21)Used By (0)

AdadgioCommonBundle
===================

[](#adadgiocommonbundle)

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

[](#installation)

Install with composer

```
composer require adadgio/common
```

Table of contents
-----------------

[](#table-of-contents)

1. [Curl](#curl)
2. [Url](#url-helper)
3. [ParamResolver](#param-resolver)
4. [JsonResponse](#json-response)

Curl
------------------------------------

[](#curl)

To do Curl requests (get or post) and return results

```
use Adadgio\Common\Http\Curl;

// GET request
$curl = new Curl();
$response = $curl
    ->get('http://example.com', array('query_param_1' => 'query param value'));

// or POST request with params
$curl = new Curl();
$response = $curl
    ->setContentType(Curl::JSON) // other options are JSON|XML|TEXT|FORL_URLENCODED|FORM_MULTIPART
    ->post('http://example.com', array('post_field_1' => 'psot field value'));

// POST request with more options
$curl = new Curl();
$response = $curl
    ->setContentType(Curl::JSON) // other options are JSON|XML|TEXT|FORL_URLENCODED|FORM_MULTIPART
    ->setAuthorizationBasic('Token', 'user', 'pass') // or ->setAuthorization('Basic', base64_encode('user:pass'))
    // or ->setAuthorization('Token', yO3my4To3en)
    ->setCookies(true)
    // ->addHeader('X-Custom-Header', 'CUst0mApiK3y')
    ->verifyHost(false) // or ->addOption(CURLOPT_SSL_VERIFYHOST, false)
    ->verifyPeer(true, "/home/my/server/cacert.pem") // second param is empty but you should set it in php.ini
    ->post('http://example.com', array('post_field_1' => 'psot field value'));
```

UrlHelper
-----------------------------------------------

[](#urlhelper)

Help to check if an URL is relative or aboslute, normalise an URL, get protocol, check protocol less...

All methods are commented in [UrlHelper.php](UrlHelper.php)

ParamResolver
-------------------------------------------------------

[](#paramresolver)

Two methods let to know if value is a valid array or valid integer (&gt;0). If it's not the case, return default value parameter.

```
use Adadgio\Common\ParamResolver;

$arrayToTest = array(
    'one'    => true,
    'barbar' => 29393,
    'first'  => 'foo',
);

$defaultArray = array(
    'one'     => false,
    'second'  => 'yolo',
);

$array = ParamResolver::toArray($arrayToTest, $defaultArray);
```

```
use Adadgio\Common\ParamResolver;

$integer = ParamResolver::toInt(430, 0);
```

JsonResponse
-----------------------------------------------------

[](#jsonresponse)

A custom easy response object handler to respond with JSON data

```
use Adadgio\Common\JsonResponse;

// $data is an object or an array
$data = array('yes' => 'no', 'bar' => 'foo');

// default response code is 200
$code = 200;

// specific headers, default: array()
$headers = array();

$array = JsonResponse::fire($data, $code, $headers);
```

Since
-------------------------------------------

[](#since)

This tool return an human date to display, like few some seconds... Default referential is the current date and time, a custom referential can be set in second parameter.

```
use Adadgio\Common\Moment\Since;
// Examples with referential date: "2016-07-29 12:00:00"

Since::format(new \DateTime('2016-06-29 09:00:00'));
// 09:00

Since::format(new \DateTime('2016-07-28 22:00:00'));
// Yesterday

Since::format(new \DateTime('2016-07-29 12:00:00'));
// Now

Since::format(new \DateTime('2016-07-29 11:59:55'));
// 5 seconds
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 51.5% 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 ~59 days

Recently: every ~251 days

Total

20

Last Release

2536d ago

Major Versions

v1.1.9 → 2.0.02016-07-29

### Community

Maintainers

![](https://www.gravatar.com/avatar/2ca29135fe422cb765f6ada15af5398dc28b857de152c07c4650be1e1e662214?d=identicon)[romainbruckert](/maintainers/romainbruckert)

---

Top Contributors

[![tibeoh](https://avatars.githubusercontent.com/u/1993658?v=4)](https://github.com/tibeoh "tibeoh (17 commits)")[![adadgio](https://avatars.githubusercontent.com/u/502070?v=4)](https://github.com/adadgio "adadgio (16 commits)")

### Embed Badge

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

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

###  Alternatives

[mkusher/padawan

Smart php completion server

2577.2k](/packages/mkusher-padawan)

PHPackages © 2026

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