承接 arielenter/laravel-code-snippets 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

arielenter/laravel-code-snippets

最新稳定版本:2.0.0

Composer 安装命令:

composer require arielenter/laravel-code-snippets

包简介

Collection of little helpers neither big nor relevant enough to be their own packages.

README 文档

README

Español

Laravel Code Snippets

Collection of little helpers neither big nor relevant enough to be their own packages.

trait CreateReadme

Provides helpers to create ‘README.md’ files.

method createReadmeFromTemplate

/**
 * A ‘README.md’ is created using a template file for the given language.
 *
 * The function ‘trans’ or ‘__’ is used to get the resulting
 * ‘readme’ file. With this in mind, the template file must use placeholders
 * in the form of ‘:key_to_translate’ style, and the replace values have to
 * be given in an array where keys are the placeholders and the values are the
 * desired replace text.
 *
 * @param string               $template Path to the template file.
 * @param string               $locale   ISO language code that the resulting
 *                                       readme file is made for, using
 *                                       ‘README.xx.md’ style to name it,
 *                                       unless it’s equal to the
 *                                       application’s current language, in
 *                                       which case ‘README.md’ name is used
 *                                       instead.
 * @param ?int                 $wrap     If an integer is given instead of null,
 *                                       the text inside the resulting
 *                                       ‘readme’ file will be wrapped using
 *                                       this value as the width.
 * @param array<string,string> $replace  Replace values that will be used on the
 *                                       template’s placeholders.
 *
 * @return string The generated content for the file
 */

method getLocaleLinks

/**
 * Producess the ‘md’ code corresponding to hyper links for every readme
 * file of every given language.
 *
 * @param array<string,string> $availableLocales ISO code as key and name as
 *                                               value of every available
 *                                               language.
 * @param string               $exception        Optional. ISO code of the 
 *                                               language we might want to leave
 *                                               out.
 * @param string               $separator        Optional. Text that should
 *                                               separate each link. By default
 *                                               it’s ‘ | ’.
 *
 * @return string Hyper links to every README file.
 */

class ComposerJson

Provides helpers to perform oparations over composer’s json file.

method editKey

/**
 * Changes the value of the given key. If the key doesn’t exist, it will be
 * added.
 *
 * @param string $key   Key
 * @param string $value Value
 *
 * @return void
 */

trait TestAssertion

Meant to be use on laravel’s phpunit TestCases to provide trait methods to test assertions.

method assertClosureThrowsAsserionFail

/**
 * Asserts that the given closure triggers an asssertion fail error.
 *
 * @param Closure $closure Closure to be tested.
 * @param ?string $failMsg If provided, makes sure that the expected resulting
 *                         assertion fail error throws the expected message.
 *
 * @return void
 */

License

GNU General Public License (GPL) version 3

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0
  • 更新时间: 2025-09-21