Available functionalities :
- Lang files translation.
- Assets images optimization.
- files/folder/project compression
You can install the package via composer:
composer global require abdelhamiderrahmouni/prodtoolsadd it to your PATH:
export PATH="$PATH:$HOME/.composer/vendor/bin"the package offers three main commands:
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 arThe 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 --jsonYou can find more details on superduper filament starter kit @riodwanto is the original author of the command, I just added the JSON output feature.
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/assetsOptions :
pathis the path to the folder containing the images to optimize; by default it's public/assets.
Arguments :
--keepto keep the original images; by default it's false.--prefixto add a prefix to the original folder's name; by default it's "old_".--detailsto display the optimization details; by default it's false.
This command will compress the project files and folders into a single archive file.
prodtools compress <path> # defaults to current directoryOptions :
pathis the path to the folder to compress; by default it's the current directory.
Arguments :
--excludemention the files and folders to exclude from the archive; by default it's ".git,node_modules".--includeDirectories and files to make sure they are included in the zip.--output-name|namespecify the output file name; by default it's FolderName in snake case like "folder_name.zip".--chunk-sizeThe maximum size of each chunk in MB, 0 for no chunking.--excludes_fileA 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.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 :
folderis the folder where the images will be saved; by default the command will create a folder named local_images in the current path.
Arguments :
--amountis the number of images to download; by default it's 5.--sizeis the size of the images to download; by default it's 200x200.--termsis the search terms to use; by default it's empty.--multi-sizeis a flag to download multiple sizes of the images; by default it's false.--sizesis the sizes of the images to download; by default it's "200x200,1280x720".--amountsis 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 countRun the following command to build a standalone application:
php production-tools app:build prodtoolsYou will then be able to execute it directly:
./builds/prodtoolsor on Windows:
C:\application\path> php builds\prodtools # this is still not ready for windowsLaravel Zero is an open-source software licensed under the MIT license.