承接 owenmelbz/laravel-stubs 相关项目开发

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

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

owenmelbz/laravel-stubs

Composer 安装命令:

composer require owenmelbz/laravel-stubs

包简介

Easily store stubs for your project to reuse whenever needed.

README 文档

README

We often find outselves having to repeat the same boilerplating when creating new files such as javascript components, blade templates etc.

This package aims to help save your brain cells for the more important things in life (like pizza) by enabling you scaffold the things you're always repeating within a project by taking influence from the other make: commands.

Installation

1- Install via composer composer require owenmelbz/laravel-stubs.

2- The package should use laravels new auto discovery, if not however you can manually register the service provider - typically done inside the app.php providers array e.g OwenMelbz\LaravelStubs\StubsServiceProvider::class.

3- If you're going to be modifying the default stubs, or adding your own stubs, you'll need to publish the config using php artisan vendor:publish --tag=stubs-config which will generate config/template_stubs.php

Usage

Run php artisan make:a {stub} {name} this will generate you a new file, based off the defined stub

The {name} will become the filename and typically the class/component name where the default @placeholder marker is used within the files.

Default stubs

You can view a full list of the default stubs from the config file -> https://github.com/OwenMelbz/Laravel-Stubs/blob/master/src/config/template_stubs.php

Modifying existing stubs

If you want to modify a default stub you can do this in 2 different ways.

The stubs are loaded in a waterfall style - so if you have your own file inside your resources/stubs folder we will use this file instead.

You can either use the same filename that is defined within the stub key of the config e.g vue-component.js and we'll use that. Or you can create a file of any name and change the stub key in a published config file.

If you want to modify every stub in the package, you can publish all the stubs in 1 go using php artisan vendor:publish --tag=stubs-stubs which will place them all in your resources/stubs folder.

Adding custom stubs

You can either publish the default config and modify it, or create your own called template_stubs.php - if you wanted you could even use php artisan make:a config template_stubs and start adding your own.

Creating a new stub requires at minimum, a stub file, an output path, and a name. Below is an example structure

'my-stub' => [
    'stub' => 'my-stub.php',
    'output_path' => resource_path('some-folder')
]

It's worth noting that the file extension of the outputted file will match that of the stub file. So in this instance we do not recommend using .stub as your file extension.

During the generation process we parse a token called @placeholder anywhere this marker is within your stub, will get replaced by the name you passed into the command. e.g

This command artisan make:a vue my-component will see a file

Vue.component('@placeholder', {

});

and generate my-component.js with the content

Vue.component('my-component', {

});

If you want to change @placeholder to something else add the placeholder => '@myothername' to the stub definition within the config.

Contributing community stubs

Please feel free to submit pull requests to add custom stubs, make sure there are no naming conflicts, and keep them as simple as possible.

Typically we adhear to a PSR-2 style for php files, I may modify the code style to make it consistent with submitted stubs.

Notes

This is a very new package, has not been heavily used in the wild, so please bare with me if you stumble across bugs, always add a PR where possible to fix issues as its massively appreciated.

Thank :D

owenmelbz/laravel-stubs 适用场景与选型建议

owenmelbz/laravel-stubs 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.11k 次下载、GitHub Stars 达 69, 最近一次更新时间为 2017 年 08 月 26 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「templates」 「laravel」 「stubs」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 owenmelbz/laravel-stubs 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 owenmelbz/laravel-stubs 我们能提供哪些服务?
定制开发 / 二次开发

基于 owenmelbz/laravel-stubs 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 69
  • Watchers: 1
  • Forks: 11
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-26