|
1 | | -# Работа с 7z архивами с помощью командной строки. |
| 1 | +# A wrapper over 7-zip (p7zip) |
2 | 2 |
|
3 | 3 | [](https://travis-ci.org/Gemorroj/Archive7z) |
4 | 4 |
|
5 | 5 |
|
6 | | -### Функции: |
| 6 | +### Features: |
7 | 7 |
|
8 | | -- распаковка всего архива; |
9 | | -- распаковка любой директории или файла в архиве; |
10 | | -- просмотр всех файлов и директорий находящихся в архиве; |
11 | | -- получение содержимого файла в архиве; |
12 | | -- удаление директории или файла из архива; |
13 | | -- добавление файлов в архив; |
14 | | -- проверка корректности архива; |
| 8 | +- Extract archive; |
| 9 | +- Extract any directory or file; |
| 10 | +- List files or directories; |
| 11 | +- Get contents of any file in archive; |
| 12 | +- Delete files or directories; |
| 13 | +- Add files or directories; |
15 | 14 |
|
16 | 15 |
|
17 | | -### Требования: |
| 16 | +### Requirements: |
18 | 17 |
|
19 | 18 | - PHP >= 5.3 |
20 | 19 | - shell |
21 | 20 | - **7-zip >= 7.30 (p7zip >= 9.38)** |
22 | 21 |
|
23 | 22 |
|
24 | | -### Примечания: |
| 23 | +### Notes: |
25 | 24 |
|
26 | | - - Список файлов/директорий отображается всегда в кодировке UTF-8 |
27 | | - - При указании файлов/директорий для распаковки, их имена нужно указывать в кидировке текущей файловой системы |
28 | | - - При распаковке архива, имена файлов/директорий запишутся в кодировке текущей файловой системы |
| 25 | + - List of files/directories is always displayed in UTF-8 |
| 26 | + - When unpacking, the names of the files/directories you need to specify the encoding of the current file system |
| 27 | + - When you unpack the archive, the file names/directories are written in the encoding of the current file system |
29 | 28 |
|
30 | 29 |
|
31 | | -### Установка через composer: |
| 30 | +### Installation: |
32 | 31 |
|
33 | | -- Добавьте проект в ваш файл composer.json: |
| 32 | +- add to composer.json: |
34 | 33 |
|
35 | 34 | ```json |
36 | 35 | { |
|
39 | 38 | } |
40 | 39 | } |
41 | 40 | ``` |
42 | | -- Установите проект: |
| 41 | +- install: |
43 | 42 |
|
44 | 43 | ```bash |
45 | 44 | $ php composer.phar update gemorroj/archive7z |
46 | 45 | ``` |
47 | 46 |
|
48 | 47 |
|
49 | | -### Пример работы: |
| 48 | +### Example: |
50 | 49 |
|
51 | 50 | ```php |
52 | 51 | <?php |
53 | 52 | use Archive7z\Archive7z; |
54 | 53 |
|
55 | 54 | $obj = new Archive7z('path_to_7z_file.7z'); |
56 | 55 |
|
| 56 | +if (!$obj->isValid()) { |
| 57 | + throw new Exception('Incorrect archive'); |
| 58 | +} |
| 59 | + |
| 60 | + |
57 | 61 | foreach ($obj->getEntries() as $entry) { |
58 | 62 | print_r($entry); |
59 | 63 | /* |
@@ -92,7 +96,7 @@ Archive7z\Entry Object |
92 | 96 | } |
93 | 97 | } |
94 | 98 |
|
95 | | -echo $obj->getContent('test/test.txt'); |
| 99 | +echo $obj->getContent('test/test.txt'); // show content of the file |
96 | 100 |
|
97 | 101 | $obj->setOutputDirectory('path_to_extract_folder/'); |
98 | 102 | $obj->extract(); // extract archive |
|
0 commit comments