定制 tobento/app-message 二次开发

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

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

tobento/app-message

最新稳定版本:2.0

Composer 安装命令:

composer require tobento/app-message

包简介

App message manager.

README 文档

README

Message manager for the app.

Table of Contents

Getting Started

Add the latest version of the app message project running this command.

composer require tobento/app-message

Requirements

  • PHP 8.4 or greater

Documentation

App

Check out the App Skeleton if you are using the skeleton.

You may also check out the App to learn more about the app in general.

Message Boot

The message boot does the following:

  • configures the messages factory
use Tobento\App\AppFactory;
use Tobento\Service\Message\MessagesFactoryInterface;

// Create the app
$app = new AppFactory()->createApp();

// Add directories:
$app->dirs()
    ->dir(realpath(__DIR__.'/../'), 'root')
    ->dir(realpath(__DIR__.'/../app/'), 'app')
    ->dir($app->dir('app').'config', 'config', group: 'config')
    ->dir($app->dir('root').'public', 'public')
    ->dir($app->dir('root').'vendor', 'vendor');

// Adding boots
$app->boot(\Tobento\App\Message\Boot\Message::class);
$app->booting();

// Implemented interfaces:
$messagesFactory = $app->get(MessagesFactoryInterface::class);

// Run the app
$app->run();

Creating Messages

Check out the Message Service - Messages Factory section to learn more about creating messages.

Translating Messages

Simply, install the App Translation bundle and boot the \Tobento\App\Translation\Boot\Translation::class:

composer require tobento/app-translation
use Tobento\App\AppFactory;

// Create the app
$app = new AppFactory()->createApp();

// Add directories:
$app->dirs()
    ->dir(realpath(__DIR__.'/../'), 'root')
    ->dir(realpath(__DIR__.'/../app/'), 'app')
    ->dir($app->dir('app').'config', 'config', group: 'config')
    ->dir($app->dir('root').'public', 'public')
    ->dir($app->dir('root').'vendor', 'vendor');
    
// Adding boots
$app->boot(\Tobento\App\Translation\Boot\Translation::class);
$app->boot(\Tobento\App\Message\Boot\Message::class);

// Run the app
$app->run();

Messages will be translated based on the Configured Translator Locale.

The configured Message Translator Modifier uses the * as resource name. Check out the Translation Resources and Translation Files Resources to learn more about it.

Check out the Add Translation or Migrate Translation section to learn how to add or migrate translations.

Logging Messages

Simply, install the App Logging bundle and boot the \Tobento\App\Logging\Boot\Logging::class:

composer require tobento/app-translation
use Tobento\App\AppFactory;

// Create the app
$app = new AppFactory()->createApp();

// Add directories:
$app->dirs()
    ->dir(realpath(__DIR__.'/../'), 'root')
    ->dir(realpath(__DIR__.'/../app/'), 'app')
    ->dir($app->dir('app').'config', 'config', group: 'config')
    ->dir($app->dir('root').'public', 'public')
    ->dir($app->dir('root').'vendor', 'vendor');
    
// Adding boots
$app->boot(\Tobento\App\Logging\Boot\Logging::class);
$app->boot(\Tobento\App\Message\Boot\Message::class);

// Run the app
$app->run();

On the App Logging Config file define the logger used for messages:

/*
|--------------------------------------------------------------------------
| Aliases
|--------------------------------------------------------------------------
*/

'aliases' => [
    'messages' => 'daily',
],

Credits

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-03-01