Download the PHP package juzaweb/laravel-download-template without Composer
On this page you can find all versions of the php package juzaweb/laravel-download-template. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download juzaweb/laravel-download-template
More information about juzaweb/laravel-download-template
Files in juzaweb/laravel-download-template
Package laravel-download-template
Short Description Download template HTML from URL in Laravel
License MIT
Informations about the package laravel-download-template
About
This package provides a simple command to download styles and scripts from a given template URL. It also generates a webpack.mix.js
file for easy asset compilation.
Installation
Configuration
Publish the configuration file:
Usage
Download Styles
This command is particularly useful when you're integrating a static template into a Laravel project and want to fetch its external style and script files directly.
🧾 Command Signature
🛠 Features
- Downloads all external CSS and JS files from a given template URL.
- Excludes certain domains from being downloaded.
- Optionally generates a
webpack.mix.js
file for easy asset compilation. - Parses and downloads assets referenced within CSS files (e.g., fonts, images — if enabled).
🔧 Options
Option | Shortcut | Description | Default |
---|---|---|---|
--output |
-o |
Output directory to save files | resources |
--mix |
Generate webpack.mix.js file |
false | |
--mix-output |
Directory where webpack.mix.js file will be saved |
root (empty) |
🧪 Example Usage
You will be prompted to input the template URL:
📂 Output Structure
After downloading, your resources
folder might look like:
⚙️ Laravel Mix File Example (generated)
📌 Notes
- Only files with valid URLs will be downloaded.
- Files from excluded domains are skipped.
Dưới đây là nội dung README bằng tiếng Anh dành cho class DownloadTemplateCommand
, giải thích chức năng và cách sử dụng lệnh Artisan này một cách rõ ràng:
Download Template
The DownloadTemplateCommand
is a Laravel Artisan command that allows you to download and convert a section of an HTML page from a specified URL into a Blade template file. It is helpful when you're importing static HTML templates into a Laravel project.
🧾 Command Signature
🛠 Features
- Downloads HTML content from a provided URL.
- Extracts a specific container (
div
,section
, etc.) using a CSS selector. - Wraps the downloaded content inside a Blade template that extends a layout.
- Saves the file to a specified directory under
resources/views
or a custom path.
🔧 Options
Option | Shortcut | Description | Default |
---|---|---|---|
--output |
-o |
Output path for the Blade file | resources/views |
--layout |
Blade layout to extend | layouts.app |
💬 Interactive Prompts
You will be prompted to input:
Prompt | Description | Default |
---|---|---|
Url Template? |
The URL of the HTML page to download | Last used value |
Container? |
The CSS selector of the container to extract | .container-fluid |
File? |
The filename to save the Blade file (e.g. home ) |
index.blade.php |
If the file name does not end in .php
, .blade.php
will be appended automatically.
📂 Output Example
Assuming:
- URL:
https://example.com/home.html
- Container:
.main-content
- File:
home
The result will be saved as:
With contents similar to:
🧪 Example Usage
Then follow the prompts:
This will generate:
🧩 Extend & Customize
You can extend this command to:
- Automatically download and transform multiple pages.
- Extract and replace assets like images or CSS links.
- Apply Laravel components or sections dynamically to the template.
📌 Notes
- The HTML content is parsed using the
Juzaweb\HtmlDom\HtmlDom
package. - The command does not validate if the container exists — if it doesn't, the generated Blade file may be empty or invalid.
- Make sure external assets are handled manually or by pairing with
style:download
.
License
This package is open-sourced software licensed under the MIT license.