Giter Site home page Giter Site logo

pinyinslug's Introduction

pinyinslug

Tags: Chinese, Pinyin, tag, slug, URL, rewrite, Bing, permalink, SEO, 标签, 别名, PHP, Laravel

Generate URL-friendly slug, post title. Chinese to Pinyin. Tested on Laravel.

Due to 'PinyinBundle' in Packagist doesn't work on Laravel, I tried to porting it with Laravel.

Installation

The Pinyinslug service provider can be installed via composer by requiring the jeepmac/pinyinslug package in your project's composer.json.

{
    "require": {
        "jeepmac/pinyinslug": "dev-master"
    }
}

Next, add the service provider to app/config/app.php.

'providers' => [
    //..
    'Jeepmac\Pinyinslug\PinyinslugServiceProvider',
]

That's it! You're good to go.

Here is a little example:

$str = Pinyinslug::ats_pinyin('生活 in Shanghai');

$str will turn to be 'sheng-huo--in-shanghai'.

Then I added Bing Translation function. You need to apply client id from Microsoft if you want to 'English' instead of 'pinyin'.

pinyinslug's People

Contributors

jeepmac avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.