定制 boomdraw/canonicalizer 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

boomdraw/canonicalizer

Composer 安装命令:

composer require boomdraw/canonicalizer

包简介

Canonicalizer package for Laravel

README 文档

README

Canonicalizer package for Laravel

Build Status StyleCI Code Coverage Quality Score Latest Version on Packagist Total Downloads PHP Version License

Installation

Via Composer

$ composer require boomdraw/canonicalizer

Laravel

The package will automatically register itself.

Lumen

Uncomment the following line in the bootstrap file:

// bootstrap/app.php:
$app->withFacades();

Register CanonicalizerServiceProvider

// bootstrap/app.php:
$app->register(Boomdraw\Canonicalizer\CanonicalizerServiceProvider::class);

Usage examples

use Boomdraw\Canonicalizer\Facades\Canonicalizer;

or

use Canonicalizer;

Methods

Canonicalizer

Canonicalizer::canonicalize()

Args string $string, bool $nullEmpty = true

Returns canonicalized string or null if $nullEmpty = true and the string is empty.

Canonicalizer::email()

Args: string $email

Returns canonicalized email without dots before @ or null if the string does not contain @

Canonicalizer::slug()

Args: string $title, string $separator = '-', ?string $language = 'en'

\Illuminate\Support\Str::slug() alias

Canonicalizer::url()

Args: string $url, string $separator = '-'

The function calls trim() function with slash (/) and backslash (\) added to charlist and slugs url path items with specified separator.

Canonicalizer::uri()

Args: sstring $url, string $separator = '-'

Canonicalizer::url() alias

Canonicalizer::macro()

Args string $name, object|callable $macro = true

Canonicalizer uses Macroable trait, so you can add methods to a class dynamically.

Canonicalizer::macro('replaceSpaces', function(string $string) {
    return str_replace(' ', '', $string);  
});

Canonicalizer::replaceSpaces('Hello World!') === 'HelloWorld!';

Testing

You can run the tests with:

composer test

Contributing

Please see CONTRIBUTING for details and a todo list.

Security

If you discover any security-related issues, please email pkgsecurity@boomdraw.com instead of using the issue tracker.

License

MIT

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-12-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固