Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit 99d794f

Browse files
committed
Made README more beautiful
* removed whitespace * added correct syntax highlighting * made wording nicer
1 parent f536d6b commit 99d794f

File tree

1 file changed

+19
-27
lines changed

1 file changed

+19
-27
lines changed

README.md

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
A class to help with creating downloads for files in PHP.
33

44

5-
## Advice
5+
## Tip
66
If you can use direct downloads, you should just use them.
77
This class is for providing downloads of files out of PHP, for example if you want to provide a download to a temporarily created file.
88

@@ -11,45 +11,37 @@ This class is for providing downloads of files out of PHP, for example if you wa
1111

1212

1313
## Create a download for a file on your file system
14-
```
15-
<?php
16-
17-
$fileDownload = FileDownloader::createFromFilePath("/path/to/file.pdf");
18-
$fileDownload->sendDownload("download.pdf");
14+
```php
15+
$fileDownload = FileDownloader::createFromFilePath("/path/to/file.pdf");
16+
$fileDownload->sendDownload("download.pdf");
1917
```
2018

2119

2220
## Create a download for a file via file pointer
23-
```
24-
<?php
25-
26-
$file = /* your file, somewhere opened with fopen() or tmpfile(), etc.. */;
27-
$fileDownload = new FileDownloader($file);
28-
$fileDownload->sendDownload("download.pdf");
21+
```php
22+
$file = /* your file, somewhere opened with fopen() or tmpfile(), etc.. */;
23+
$fileDownload = new FileDownloader($file);
24+
$fileDownload->sendDownload("download.pdf");
2925
```
3026

3127

3228
## Create a download for a file via the content
33-
```
34-
<?php
35-
36-
$content = "This is the content of the file:";
37-
$fileDownload = FileDownloader::createFromString($content);
38-
$fileDownload->sendDownload("download.txt");
29+
```php
30+
$content = "This is the content of the file:";
31+
$fileDownload = FileDownloader::createFromString($content);
32+
$fileDownload->sendDownload("download.txt");
3933
```
4034

4135

4236
For example, you can create downloads for PDF files, generated by Zend (or any other library):
4337

44-
```
45-
<?php
46-
47-
$pdf = new Zend_Pdf();
48-
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
49-
$pdf->pages[] = $page;
38+
```php
39+
$pdf = new Zend_Pdf();
40+
$page = $pdf->newPage(Zend_Pdf_Page::SIZE_A4);
41+
$pdf->pages[] = $page;
5042

51-
/* draw content in the pdf ... */
43+
/* draw content in the pdf ... */
5244

53-
$fileDownload = FileDownloader::createFromString($pdf->render());
54-
$fileDownload->sendDownload("download.pdf");
45+
$fileDownload = FileDownloader::createFromString($pdf->render());
46+
$fileDownload->sendDownload("download.pdf");
5547
```

0 commit comments

Comments
 (0)