oblak/vocative-laravel 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

oblak/vocative-laravel

最新稳定版本:v1.0.0

Composer 安装命令:

composer require oblak/vocative-laravel

包简介

This is my package vocative-laravel

README 文档

README

Larative 🗣️

Vocative Service Provider for Larative

Packagist Version Packagist PHP Version Total Downloads

This library allows you to effortlessly convert Serbian personal names to their correct vocative form in your Laravel application.

Installation

You can install the package via composer:

composer require oblak/vocative-laravel

You can publish the config file with:

php artisan vendor:publish --tag="vocative-config"

This is the contents of the published config file:

<?php

return [
    'dictionary' => [],
    'ignore_dictionary' => false,
];

Usage

You can use the package in your application by calling the Vocative class directly or using the provided Blade directives.

Using the Facade

You can use the Vocative facade to transform names to their vocative form:

use Oblak\Vocative\Facades\Vocative;

// Transform a name to vocative case
echo Vocative::make('Милица'); // "Милице"
echo Vocative::make('Марко');  // "Марко"

// Force transformation (bypass dictionary)
echo Vocative::make('Лука', true); // Forces transformation even if in dictionary

Using Blade Directives

The package provides two Blade directives for convenient use in your templates:

{{-- Using @vocative directive --}}
Hello, @vocative('Милица')!

{{-- Using the shorter @voc alias --}}
Hello, @voc('Марко')!

Custom Dictionary

You can define custom vocative forms in the configuration file:

// config/vocative.php
return [
    'dictionary' => [
        'CUSTOM_NAME' => 'CUSTOM_VOCATIVE_FORM',
        'Лука' => 'Луко',
    ],
    'ignore_dictionary' => false, // Set to true to always force transformation
];

Testing

composer test

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-05-21