PHPackages                             juzaweb/laravel-download-template - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. juzaweb/laravel-download-template

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

juzaweb/laravel-download-template
=================================

Download template HTML from URL in Laravel

1.0.0(11mo ago)1144MITPHPPHP &gt;=8.0

Since May 25Pushed 7mo agoCompare

[ Source](https://github.com/juzaweb/laravel-download-template)[ Packagist](https://packagist.org/packages/juzaweb/laravel-download-template)[ RSS](/packages/juzaweb-laravel-download-template/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (2)Used By (0)

About
=====

[](#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
============

[](#installation)

```
composer require juzaweb/laravel-download-template --dev
```

Configuration
=============

[](#configuration)

Publish the configuration file:

```
php artisan vendor:publish --tag=template-downloader-config
```

Usage
=====

[](#usage)

Download Styles
---------------

[](#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

[](#-command-signature)

```
php artisan style:download
```

---

### 🛠 Features

[](#-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

[](#-options)

OptionShortcutDescriptionDefault`--output``-o`Output directory to save files`resources``--mix`Generate `webpack.mix.js` filefalse`--mix-output`Directory where `webpack.mix.js` file will be savedroot (empty)---

### 🧪 Example Usage

[](#-example-usage)

```
php artisan style:download --output=resources/template --mix --mix-output=resources/template
```

You will be prompted to input the template URL:

```
Url Template? https://example.com/template

```

---

### 📂 Output Structure

[](#-output-structure)

After downloading, your `resources` folder might look like:

```
resources/
└── template/
    ├── css/
    │   └── style.css
    ├── js/
    │   └── script.js
    └── webpack.mix.js  (if --mix is used)

```

---

### ⚙️ Laravel Mix File Example (generated)

[](#️-laravel-mix-file-example-generated)

```
const mix = require('laravel-mix');

mix.styles([
    'resources/template/css/style.css'
], 'resources/template/css/main.css');

mix.combine([
    'resources/template/js/script.js'
], 'resources/template/js/main.js');
```

---

### 📌 Notes

[](#-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
-----------------

[](#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

[](#-command-signature-1)

```
php artisan html:download
```

---

### 🛠 Features

[](#-features-1)

- 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

[](#-options-1)

OptionShortcutDescriptionDefault`--output``-o`Output path for the Blade file`resources/views``--layout`Blade layout to extend`layouts.app`---

### 💬 Interactive Prompts

[](#-interactive-prompts)

You will be prompted to input:

PromptDescriptionDefault`Url Template?`The URL of the HTML page to downloadLast 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

[](#-output-example)

Assuming:

- URL: `https://example.com/home.html`
- Container: `.main-content`
- File: `home`

The result will be saved as:

```
resources/views/home.blade.php

```

With contents similar to:

```
@extends('layouts.app')

@section('content')

@endsection
```

---

### 🧪 Example Usage

[](#-example-usage-1)

```
php artisan html:download --output=resources/views/templates --layout=layouts.app
```

Then follow the prompts:

```
Url Template? https://example.com/index.html
Container? .content
File? homepage

```

This will generate:

```
resources/views/templates/homepage.blade.php

```

---

### 🧩 Extend &amp; Customize

[](#-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

[](#-notes-1)

- 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
=======

[](#license)

This package is open-sourced software licensed under the [MIT license](./LICENSE).

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance58

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

353d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3169e8a8781068840e9300a57785089da521287dbe0279fc9cc7e8de1c1d95a9?d=identicon)[juzaweb](/maintainers/juzaweb)

---

Top Contributors

[![juzaweb](https://avatars.githubusercontent.com/u/47020363?v=4)](https://github.com/juzaweb "juzaweb (15 commits)")

---

Tags

laravellaravel-packagelaravel toolsdownload stylesdownload templates

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/juzaweb-laravel-download-template/health.svg)

```
[![Health](https://phpackages.com/badges/juzaweb-laravel-download-template/health.svg)](https://phpackages.com/packages/juzaweb-laravel-download-template)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
