PHP Classes

PHP Website Downloader: Download pages and files of a site to local files

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-02-21 (3 months ago) RSS 2.0 feedNot enough user ratingsTotal: 91 All time: 9,927 This week: 65Up
Version License PHP version Categories
websitedownloader 1.0.0The PHP License5HTML, Files and Folders, Web services, P...


This package can download pages and files of a site to local files.

It can take the URL of a site and download the HTML of the page to a local file.

The package can also parse the HTML to extract the URLs of other page files like the images, icons, CSS, and JavaScript.

Picture of Cedric Maenetja
  Performance   Level  
Name: Cedric Maenetja is available for providing paid consulting. Contact Cedric Maenetja .
Classes: 4 packages by
Country: South Africa South Africa
Age: ???
All time rank: 388821 in South Africa South Africa
Week rank: 225 Up2 in South Africa South Africa Up
Innovation award
Innovation award
Nominee: 1x

Winner: 1x


What is the best PHP website crawler class?
Download a complete website to local storage



require ('WebsiteDownloader.php');

$downloader = new WebsiteDownloader([
'domain' => '',
'output_dir' => 'local_files'




Website Downloader

This PHP class, WebsiteDownloader, is designed to download various assets (HTML files, CSS files, JavaScript files, images, etc.) from a given website. It provides methods to download specific types of assets or all assets at once.


Instantiate the WebsiteDownloader class by providing the required parameters: the domain of the website to download from and the output directory where the downloaded files will be saved.

$downloader = new WebsiteDownloader([
    'domain' => '',
    'output_dir' => '/path/to/output/directory'


  • download($asset): Downloads the specified type of asset. If no asset type is provided, it downloads all assets. Supported asset types are 'html', 'css', 'js', and 'img'.
  • downloadAssetFromURL($url): Downloads a specific asset from the provided URL.



Downloading a specified type of asset from the given domain.

try {
    // downloads all assets (html, css, js, images, etc)

    // download html

    // download js
    // download css (this will include favicons if found)

    // download images

} catch (InvalidArgumentException $e) {
    echo "Error: " . $e->getMessage();


Downloads a specific asset from the provided URL

// downloads the index.html file
// you can pass any file in the url to download such as images, js, css, etc


  • PHP 7.0 or higher
  • cURL extension enabled


  • This class uses cURL to download files from the website. Make sure cURL extension is enabled in your PHP configuration.
  • Be cautious while using this class to avoid downloading files from unauthorized websites or violating terms of service.
  • Downloading files from a website may not always be possible due to restrictions set by the website owner or technical limitations in its design.


This PHP class was created by Yung Cet (Cedric Maenetja).


This PHP class is released under the MIT License. See the LICENSE file for details.

  Files folder image Files  
File Role Description
Accessible without login Plain text file demo.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation
Plain text file WebsiteDownloader.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,927
This week:65Up