Skip to main content

English Documentation

Artisan Command: post:process

This command is a unified post-processor for formatting and optimizing various source files. It can read from a local path or a remote URL and write the output to a local path or any configured Laravel filesystem disk (like Amazon S3 or Minio). It acts as a single entry point to run different formatters like Laravel Pint (PHP), Tidy (HTML), Blade Formatter (Blade), and Prettier (JS, TS, Vue, etc.).

1. Prerequisites & Installation

Before using this command, ensure all required tools are installed.

a. Laravel Pint (for PHP files)

Pint is included with modern Laravel installations. If missing, install it:

b. Tidy CLI (for HTML files)

This is a system command-line tool.
  • Linux (Ubuntu/Debian): sudo apt-get install tidy
  • macOS (Homebrew): brew install tidy-html5

c. Node.js Tools (for Blade, JS, JSON, TS, & Vue files)

Install the required formatters via npm:

2. Usage

The command can process a single file (local or remote) or an entire local directory. Synopsis:

Options


3. Examples

a. Processing a Remote URL to a Local File

Fetches a file from a URL, formats it, and saves it to the local storage directory.

b. Processing a Local File to an S3 Bucket

Formats a local JavaScript file and uploads the result to an S3 disk configured in config/filesystems.php.

c. Processing a Local Directory to a Minio Bucket

Finds all .blade.php files in a local directory, formats them, and uploads them to a minio disk, preserving the original file structure.

d. Processing a Local Directory to a Local Directory (Standard Use)

This will find all .vue files, format them, and save them to a different local directory.

Dokumentasi Bahasa Indonesia

Perintah Artisan: post:process

Perintah ini adalah post-processor terpadu untuk memformat dan mengoptimalkan berbagai jenis file sumber. Ia dapat membaca dari path lokal atau URL remote dan menulis hasilnya ke path lokal atau disk filesystem Laravel yang terkonfigurasi (seperti Amazon S3 atau Minio). Perintah ini berfungsi sebagai satu pintu masuk untuk menjalankan formatter seperti Laravel Pint (PHP), Tidy (HTML), Blade Formatter (Blade), dan Prettier (JS, TS, Vue, dll.).

1. Prasyarat & Instalasi

Sebelum menggunakan perintah ini, pastikan semua perangkat yang dibutuhkan telah terinstal.

a. Laravel Pint (untuk file PHP)

Pint sudah termasuk dalam instalasi Laravel modern. Jika belum ada, instal dengan:

b. Tidy CLI (untuk file HTML)

Ini adalah perangkat command-line sistem.
  • Linux (Ubuntu/Debian): sudo apt-get install tidy
  • macOS (Homebrew): brew install tidy-html5

c. Perangkat Node.js (untuk file Blade, JS, JSON, TS, & Vue)

Instal formatter yang dibutuhkan melalui npm:

2. Penggunaan

Perintah ini dapat memproses satu file tunggal (lokal atau remote) atau seluruh direktori lokal. Sinopsis:

Opsi


3. Contoh Penggunaan

a. Memproses URL Remote ke File Lokal

Mengambil file dari URL, memformatnya, dan menyimpannya di direktori storage lokal.

b. Memproses File Lokal ke Bucket S3

Memformat file JavaScript lokal dan mengunggah hasilnya ke disk S3 yang telah dikonfigurasi di config/filesystems.php.

c. Memproses Direktori Lokal ke Bucket Minio

Mencari semua file .blade.php di direktori lokal, memformatnya, dan mengunggahnya ke disk minio dengan mempertahankan struktur file aslinya.

d. Memproses Direktori Lokal ke Direktori Lokal (Penggunaan Standar)

Perintah ini akan mencari semua file .vue, memformatnya, dan menyimpannya ke direktori lokal yang berbeda.

Complete app/Console/Commands/PostProcessor.php Command

This is the final, fully-functional code for your command.