定制 yebto/laravel-transliterator-api 二次开发

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

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

yebto/laravel-transliterator-api

最新稳定版本:v1.0.0

Composer 安装命令:

composer require yebto/laravel-transliterator-api

包简介

Laravel SDK wrapper for YEB Transliterator API

README 文档

README

Laravel Transliterator API SDK

Simple, fluent Laravel 10 / 11 wrapper around the YEB Transliterator endpoint—convert Cyrillic, Greek, and other non-Latin text to Romanised output or various case/sluggified forms straight from your Laravel codebase.

Table of Contents

  1. Features
  2. Requirements
  3. Installation
  4. Configuration
  5. Usage
  6. Options Reference
  7. Examples
  8. Troubleshooting
  9. Contributing
  10. License

Features

  • Zero-boilerplate – auto-discovered service provider & facade
  • Supports Laravel 10 & 11 via illuminate/support
  • One-line helper TransliteratorAPI::transliterate() for every request
  • Easily publish & tweak default config/transliterator.php
  • Sensible cURL defaults (timeout, JSON headers, UA string)
  • Throws expressive RuntimeExceptions on missing keys / API errors

Requirements

Minimum
PHP 8.1
Laravel 10.x / 11.x
YEB Account Valid API key (YEB_KEY_ID)

Installation

composer require yebto/laravel-transliterator-api

# (optional) publish the config so you can edit defaults
php artisan vendor:publish --tag=transliterator-config

Configuration

# .env
YEB_KEY_ID=****************************************
YEB_API_BASE=https://api.yeb.to/v1/   # override if self-hosting

The published config/transliterator.php lets you tune:

  • base_url – alternate endpoint
  • global cURL options (timeouts, headers, etc.)

Usage

use TransliteratorAPI;

// basic
$result = TransliteratorAPI::transliterate('bg', 'Дядовите чички');

/*
[
    "lang"      => "bg",
    "type"      => "plain",
    "delimiter" => "-",
    "original"  => "Дядовите чички",
    "result"    => "Dyadovite chichki"
]
*/

// slug with custom delimiter
TransliteratorAPI::transliterate(
    lang:      'ru',
    text:      'Мой дядя самых честных правил',
    type:      'slug',
    delimiter: '_'
); // => "moy_dyadya_samykh_chestnykh_pravil"

Options Reference

Key Allowed values Default
lang bg, ru, el, … (see YEB docs)
text Source string
type plain, slug, snake, camel, capital, upper, lower plain
delimiter Single character (only used when type = slug) -

Examples

Route stub (Laravel API)

Route::post('/transliterator', function () {
    return TransliteratorAPI::transliterate(
        request('lang'),
        request('text'),
        request('type', 'plain'),
        request('delimiter', '-')
    );
});

Programmatic call inside a job

class GenerateFilename implements ShouldQueue
{
    public function handle()
    {
        $slug = TransliteratorAPI::transliterate(
            'el',
            $this->originalTitle,
            'slug'
        )['result'];

        // ...
    }
}

Free Tier Access

🎁 You can get 1,000+ free API requests by registering on yeb.to using your Google account.

Steps:

  1. Visit https://yeb.to
  2. Click Login with Google
  3. Retrieve your API key and add it to your .env as YEB_KEY_ID

No credit card required!

Troubleshooting

If you encounter issues:

  • Ensure your API key is correct and active
  • Double-check that the config file is published
  • Validate parameters against the API reference
  • Check for typos in method names or required fields

Support

License

© NETOX Ltd. Licensed under a proprietary or custom license unless stated otherwise in the repository.

💬 Have an idea, feature request, or want to suggest a new YouTube-related API? Reach out to us at support@yeb.to — we’d love to hear from you!

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-07-30