PHPackages                             mikeweb85/dsn - 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. [Database &amp; ORM](/categories/database)
4. /
5. mikeweb85/dsn

ActiveLibrary[Database &amp; ORM](/categories/database)

mikeweb85/dsn
=============

Parse your DSN

1.0.1(7y ago)013MITPHPPHP ^5.5 || ^7.0

Since Apr 4Pushed 6y ago1 watchersCompare

[ Source](https://github.com/mikeweb85/dsn)[ Packagist](https://packagist.org/packages/mikeweb85/dsn)[ RSS](/packages/mikeweb85-dsn/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

DSN parser
==========

[](#dsn-parser)

Install
-------

[](#install)

Via Composer

```
composer require mikeweb85/dsn
```

Usage
-----

[](#usage)

The DSN parser is super simple to use. See the following example:

```
$dsn = new DSN('mysql://root:root_pass@127.0.0.1:3306/test_db/test_table');

$dsn->isValid();      // true
$dsn->getProtocol();  // 'mysql'
$dsn->getUsername();  // 'root'
$dsn->getPassword();  // 'root_pass'
$dsn->getFirstHost(); // '127.0.0.1'
$dsn->getFirstPort(); // 3306
$dsn->getDatabase();  // 'test_db'
$dsn->getTable();  // 'test_table'
```

Testing
-------

[](#testing)

```
$ composer test
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

Credit
------

[](#credit)

This project is inpspired by [SncRedisBundle](https://github.com/snc/SncRedisBundle/blob/master/DependencyInjection/Configuration/RedisDsn.php)and [PHP-cache](https://github.com/php-cache/adapter-bundle/blob/master/src/DSN.php).

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 70.4% 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 ~1 days

Total

2

Last Release

2598d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/72afee8aa5ccd8103a68763e752d152e9ec60c75bfb66de5553c3842586cf529?d=identicon)[mikeweb85](/maintainers/mikeweb85)

---

Top Contributors

[![Nyholm](https://avatars.githubusercontent.com/u/1275206?v=4)](https://github.com/Nyholm "Nyholm (19 commits)")[![mikeweb85](https://avatars.githubusercontent.com/u/3333004?v=4)](https://github.com/mikeweb85 "mikeweb85 (6 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")[![Toflar](https://avatars.githubusercontent.com/u/481937?v=4)](https://github.com/Toflar "Toflar (1 commits)")

---

Tags

parserdatabasedatasourcedsndsn parser

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mikeweb85-dsn/health.svg)

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

###  Alternatives

[nyholm/dsn

Parse your DSN strings in a powerful and flexible way

10622.9M34](/packages/nyholm-dsn)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[craftcms/fix-fks

Restore missing foreign key constraints in the database.

1217.4k](/packages/craftcms-fix-fks)

PHPackages © 2026

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