abdelhamiderrahmouni/prodtools 问题修复 & 功能扩展

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

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

abdelhamiderrahmouni/prodtools

Composer 安装命令:

composer require abdelhamiderrahmouni/prodtools

包简介

A set of tools i use to optimize my work.

README 文档

README

Prodtools

Total Downloads Latest Stable Version License

A set of command line tools to help me ship code faster, made with laravel zero.

Available functionalities :

  • Lang files translation.
  • Assets images optimization.
  • files/folder/project compression

Documentation

General Use

Installation

You can install the package via composer:

composer global require abdelhamiderrahmouni/prodtools

add it to your PATH:

export PATH="$PATH:$HOME/.composer/vendor/bin"

Usage

the package offers three main commands:

translations

This command will translate your lang files from the source language to the target language or languages, it supports multiple languages and can output the result in JSON format.

prodtools translate <from> <to:multiple languages> [--json]

example: The following translates the php files holding the translations from en language to fr and ar languages and outputs folders for ar and fr languages.

prodtools translate en fr ar

The following translates the JSON files holding the translations from en language to fr and ar languages and outputs the translations to ar.json and fr.json files.

prodtools translate en fr ar --json

You can find more details on superduper filament starter kit @riodwanto is the original author of the command, I just added the JSON output feature.

Assets optimization

The idea behind this command came from the need to optimize the images in the assets folder before shipping the application. As doing that manually is a tedious task, I decided to automate it.

This command will optimize the images in the assets folder.

prodtools images:comporess <path> # defaults to public/assets

Options :

  • path is the path to the folder containing the images to optimize; by default it's public/assets.

Arguments :

  • --keep to keep the original images; by default it's false.
  • --prefix to add a prefix to the original folder's name; by default it's "old_".
  • --details to display the optimization details; by default it's false.

Project compression

This command will compress the project files and folders into a single archive file.

prodtools compress <path> # defaults to current directory

Options :

  • path is the path to the folder to compress; by default it's the current directory.

Arguments :

  • --exclude mention the files and folders to exclude from the archive; by default it's ".git,node_modules".
  • --include Directories and files to make sure they are included in the zip.
  • --output-name|name specify the output file name; by default it's FolderName in snake case like "folder_name.zip".
  • --chunk-size The maximum size of each chunk in MB, 0 for no chunking.
  • --excludes_file A file containing directories and files to exclude from the zip (should be in the root of the project path) by default it will look for .prodtools_compress_excludes.
prodtools compress # compress the current directory, this will look for .prodtools_compress_excludes file in the root of the project and exclude the files and folders mentioned in it.
prodtools compress --exclude=".git,node_modules,.github,.idea,storage,.env,public/.htaccess"
prodtools compress --include="node_modules" # compress the current directory and include the node_modules folder.
prodtools compress --output-name="my_project.zip" # compress the current directory and name the output file my_project.zip.
prodtools compress --chunk-size="10" # compress the current directory and split the output file into chunks of 10MB.

Get Random Images from Unsplash

This command will download random images from unsplash and save them in the specified folder.

prodtools images:get <folder> --amount "<count>" --size "<width>x<height>" --terms "<search terms>" --multi-size --sizes "<width>x<height>,<width>x<height>,..." --amounts "<count>,<count>,..."

Options :

  • folder is the folder where the images will be saved; by default the command will create a folder named local_images in the current path.

Arguments :

  • --amount is the number of images to download; by default it's 5.
  • --size is the size of the images to download; by default it's 200x200.
  • --terms is the search terms to use; by default it's empty.
  • --multi-size is a flag to download multiple sizes of the images; by default it's false.
  • --sizes is the sizes of the images to download; by default it's "200x200,1280x720".
  • --amounts is the number of images to download for each size; by default it's "5,5"

example:

prodtools images:get public/assets/images --amount "10" --size "1920x1080" --terms "nature,animals"
prodtools images:get public/assets/images --multi-size --sizes "1920x1080,1280x720,640x480" --amounts "5,3,2" # make sure the amounts match the sizes count

Development

build standalone application

Run the following command to build a standalone application:

php production-tools app:build prodtools

You will then be able to execute it directly:

./builds/prodtools

or on Windows:

C:\application\path> php builds\prodtools # this is still not ready for windows

License

Laravel Zero is an open-source software licensed under the MIT license.

abdelhamiderrahmouni/prodtools 适用场景与选型建议

abdelhamiderrahmouni/prodtools 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 60 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 03 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 abdelhamiderrahmouni/prodtools 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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