max13/url-parser 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

max13/url-parser

Composer 安装命令:

composer require max13/url-parser

包简介

URL parser for PHP, allow you to extract every piece of information of a URL/HOST, structured and clean.

README 文档

README

Description

MXUrlParser is capable of parsing a complete URL and extract some parts of it like the URL parts (using php parse_url() function) and some domain name parts (using Mozilla public suffix list).

Available parts are (Assuming URL is https://dev.api.example.co.uk/1/2/3?key=val#anchor):

  • scheme: https
  • host: dev.api.example.co.uk
  • path: /1/2/3
  • query: key=val
  • fragment: anchor
  • subdomain: dev
  • domain: api.example
  • tld: co.uk

Required

  • PHP >= 5.3

How to download

There are several ways to download MxUrlParser-PHP:

  • Install with composer ("max13/url-parser": "dev-master")
  • Clone the github repository with git clone <repo> [<dest>]
  • Download the zip file on github directly
  • Try to find another one by yourself :/

Then place it where you want (readable location, in order to load it).

How to use

Let's say your URL is: dev.api.example.co.uk/1/2/3?key=val#anchor

You can parse it with the MX\UrlParser\UrlParser class:

<?php

use MX\UrlParser\UrlParser;

$p_url = new UrlParser('dev.api.example.co.uk/1/2/3?key=val#anchor');

/*
$p_url->scheme; // === null
$p_url->host; // == 'dev.api.example.co.uk'
$p_url->subdomain; // == 'dev'
$p_url->tld; // == 'co.uk'
*/
?>

That's it, as simple as this...!

统计信息

  • 总下载量: 650
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: CC-BY-NC-SA-3.0
  • 更新时间: 2013-11-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固