承接 neuron-php/formatting 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

neuron-php/formatting

最新稳定版本:0.7.1

Composer 安装命令:

composer require neuron-php/formatting

包简介

Data formatters..

README 文档

README

CI codecov

Neuron-PHP Formatting

Overview

Installation

Install php composer from https://getcomposer.org/

Install the neuron formatting component:

composer require neuron-php/formatting

Formatting

Currency

Format a number as currency:

    $Formatter = new Currency();
    echo $Formatter->format( 5 );
```php
    $Formatter = new Currency();
    $Formatter->setPadLength( 6 );
    echo $Formatter->format( 5 );    

Output:

$__5.00

Format a number as currency with a custom currency symbol, pad character and pad length:

    $Formatter = new Currency();
    $Formatter->setCurrencySymbol( "£" );
    $Formatter->setPadLength( 11 );
    $Formatter->setPadCharacter( '-' );

Output:

£-------5.00

Date

Format a date:

    $Formatter = new Date();
    echo $Formatter->format( '12/23/2024' )

Output:

2024-12-23

Format a date with a custom format:

    $Formatter = new Date();
    $Formatter->setFormat( 'd/m/Y' );
    echo $Formatter->format( '12/23/2024' )

Output:

23/12/2024

DateTime

Format a date and time:

    $Formatter = new DateTime();
    echo $Formatter->format( '12/23/2024 13:30' )

Output:

2024-12-24 1:30 pm

Format a date and time with a custom format:

    $Formatter = new DateTime();
    $Formatter->setFormat( 'd/m/Y H:i' );
    echo $Formatter->format( '12/23/2024 13:30' )

Output:

23/12/2024 13:30

Time

Format a time:

    $Formatter = new Time();
    echo $Formatter->format( '13:30' )

Output

1:30 pm

Format a time with a custom format:

    $Formatter = new Time();
    $Formatter->setFormat( 'H:i:s' );
    $Formatter->format( '13:30:40' )

Output:

13:30:40

PhoneNumber

Format a 10-digit phone number:

    $Formatter = new PhoneNumber();
    echo $Formatter->format( "1234567890" )

Output:

(123) 456-7890

Format a phone 7-digit phone number:

    $Formatter = new PhoneNumber();
    echo $Formatter->format( "1234567" )

Output:

123-4567

Format an international phone number:

    $Formatter = new PhoneNumber();
    echo $Formatter->format( "12345678901234567890" )

Output:

+12 34 567 89012

More Information

You can read more about the Neuron components at neuronphp.com

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-23