randsonjs/inflect

一个用于处理葡萄牙语单词的PHP类

v0.2.1 2016-06-22 16:40 UTC

This package is not auto-updated.

Last update: 2024-09-25 13:40:33 UTC


README

MIT License Composer Version

一个用于处理葡萄牙语单词的PHP类

依赖项

  1. 如果您还没有PHP,请安装PHP
  2. 如果您还没有,请安装Composer

用法

Inflect(即葡萄牙语)的用法示例。

<?php

use Inflect\Inflect

$inflector = new Inflect;

$inflector->pluralize('pão');            // pães
$inflector->pluralize('carro');          // carros

$inflector->singularize('carros');       // carro
$inflector->singularize('pães');         // pão

$inflector->camelize('tablename');       // TableName
$inflector->camelize('tablename', true); // tableName

您也可以通过Facade类不实例化对象来使用它。

<?php

use Inflect\Facade as Inflect; // Use facade to be able to do static calls

Inflect::pluralize('carro');          // carros
Inflect::singularize('carros');       // carro
Inflect::camelize('tablename');       // TableName

安装

推荐通过composer安装此包。

创建一个composer.json文件。

{
    "minimum-stability": "dev",
    "require": {
        "randsonjs/inflect": "*"
    }
}

运行命令安装。

$ composer install

文件结构

.
|-- src/
|-- tests/
|-- .editorconfig
|-- .gitignore
|-- composer.json

src/

包的主要文件,在此目录中您可以找到Inflect类。

tests/

Inflect类的测试目录。测试使用PHPUnit进行。

.editorconfig

此文件用于统一不同编辑器和IDE的编码风格。

如果您还没有听说过这个项目,请访问editorconfig.org

.gitignore

我们不希望Git跟踪的文件列表。

有关更多详细信息,请参阅Git Ignoring Files Guide

composer.json

指定通过Composer加载的所有依赖项。

有关更多详细信息,请参阅composer.json项目设置。

贡献

  1. fork它!
  2. 创建您的功能分支:git checkout -b my-new-feature
  3. 提交您的更改:git commit -am '添加一些功能'
  4. 推送到分支:git push origin my-new-feature
  5. 提交pull请求 :D

许可证

MIT许可证 © Randson Oliveira