PHPackages                             zyan/url-info - 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. zyan/url-info

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

zyan/url-info
=============

url信息

2.0.6(1y ago)014.5kMITPHPPHP &gt;=7.3

Since Sep 11Pushed 1y ago1 watchersCompare

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

READMEChangelog (1)Dependencies (3)Versions (9)Used By (0)

zyan/url-info
=============

[](#zyanurl-info)

url信息

要求
--

[](#要求)

1. php &gt;= 7.3
2. Composer

安装
--

[](#安装)

```
composer require zyan/url-info -vvv
```

用法
--

[](#用法)

```
use Zyan\UrlInfo\UrlInfo;

$urlInfo = new UrlInfo('http://www.baidu.com/abc/123/test.php?a=2');
```

获取所有信息

```
$urlInfo->getData();

/*

Array
(
    [url] => http://www.baidu.com/123/abc/123.php?abc=1
    [scheme] => http
    [host] => www.baidu.com
    [port] => 80
    [domain] => baidu.com
    [suffix] => com
    [base_url] => http://www.baidu.com
    [pwd_url] => http://www.baidu.com/123/abc
    [dirname] => /123/abc
    [filename] => 123
    [extension] => php
    [query] => abc=1
    [file] => 123.php
)
*/
```

单个获取

```
//获取协议
$urlInfo->getScheme();

//获取域名
$urlInfo->getHost();

//获取端口
$urlInfo->getPort();

//获取顶级域名
$urlInfo->getDomain();

//获取域名后缀
$urlInfo->getSuffix();

//获取文件后缀
$urlInfo->getExtension();

//获取根URL
$urlInfo->getBaseUrl();

//获取文件全名
$urlInfo->getFile();

//获取文件名(不带后缀)
$urlInfo->getFilename();

//获取传入的URL
$urlInfo->getUrl();

//获取GET参数
$urlInfo->getQuery();

//获取文件当前URL
$urlInfo->getPwdUrl();

//获取文件当前目录
$urlInfo->getDirname();
```

参与贡献
----

[](#参与贡献)

1. fork 当前库到你的名下
2. 在你的本地修改完成审阅过后提交到你的仓库
3. 提交 PR 并描述你的修改，等待合并

> 注: 本项目同时发布在gitee 请使用github提交
> github:

License
-------

[](#license)

[MIT license](https://opensource.org/licenses/MIT)

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Recently: every ~4 days

Total

8

Last Release

709d ago

Major Versions

1.0.0 → 2.0.02024-05-19

### Community

Maintainers

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

---

Top Contributors

[![aa24615](https://avatars.githubusercontent.com/u/33275679?v=4)](https://github.com/aa24615 "aa24615 (10 commits)")

---

Tags

urldomainInfoParseUrl

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/zyan-url-info/health.svg)

```
[![Health](https://phpackages.com/badges/zyan-url-info/health.svg)](https://phpackages.com/packages/zyan-url-info)
```

###  Alternatives

[spatie/url

Parse, build and manipulate URL's

73914.3M97](/packages/spatie-url)[jbroadway/urlify

A fast PHP slug generator and transliteration library that converts non-ascii characters for use in URLs.

6737.4M62](/packages/jbroadway-urlify)[league/uri-components

URI components manipulation library

31932.3M67](/packages/league-uri-components)[sabre/uri

Functions for making sense out of URIs.

29335.2M40](/packages/sabre-uri)[spomky-labs/base64url

Base 64 URL Safe Encoding/Decoding PHP Library

15439.5M49](/packages/spomky-labs-base64url)[misd/linkify

Converts URLs and email addresses in text into HTML links

1122.9M10](/packages/misd-linkify)

PHPackages © 2026

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