Skip to content

Commit

Permalink
Update install.md
Browse files Browse the repository at this point in the history
  • Loading branch information
spipu committed Oct 6, 2021
1 parent ce25758 commit a496739
Showing 1 changed file with 14 additions and 29 deletions.
43 changes: 14 additions & 29 deletions doc/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,30 @@

## Composer and Packagist

You must use Composer to install Html2Pdf.
You have to use Composer to install Html2Pdf.

If you do not know what is Composer, you are a few years late...
If you do not know what is Composer:

It is used by all the modern PHP applications (Magento2, Drupal, EasyPlatform, Symfony, ...).

You can read all the pages on https://getcomposer.org/doc/

You can find all the available packages on https://packagist.org/

For example, you can find Html2Pdf: https://packagist.org/packages/spipu/html2pdf

You have to commit the `composer.json` and `composer.lock` files, but **never** commit the `vendor` folder.

If you do not understand why, it is because you have not read the Composer documentation...
* You can find the documentation on https://getcomposer.org/doc/
* You can find all the available packages on https://packagist.org/
* For example, you can find Html2Pdf: https://packagist.org/packages/spipu/html2pdf

## Install

You have just to launch the following command on the root folder of your project:
You just have to launch the following command on the root folder of your project:

```bash
composer require spipu/html2pdf
```

If you do not want to use composer, you will need to:

* manually clone the html2pdf repository
* manually clone all the repositories of the used dependencies
* manage manually the PS4 autoload

But it is not the recommaned way to instal Html2Pdf. No help will be provided in this case.

### First Test

Here is a HelloWorld example, that you can put on the root folder of your project.
Expand All @@ -46,19 +46,4 @@ Html2Pdf use the PSR-4 autoloader of Composer. You have just to require it. Neve

Then, you have just to use the main class `Spipu\Html2Pdf\Html2Pdf`, with the 2 main methods `writeHTML` and `output`.

### And on production ?

You have **not** to install composer on your production server.

You have to install composer **only** on your dev environement. Composer is a dev tool.

To deliver you app on a server, you have to (on you dev environement) :

* Git clone the tag/branch that you want to deliver
* Launch the command `composer install --no-dev`
* Remove the useless files (like the `.git` folder)
* Zip all

That's all, you have a beautifull package that can be deliver on a server !

[back](./README.md)

0 comments on commit a496739

Please sign in to comment.