Skip to content

Commit f9b2716

Browse files
author
Flavius12
committed
v2.1
1 parent e8a3293 commit f9b2716

4 files changed

Lines changed: 456 additions & 274 deletions

File tree

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ First of all thank you to contribute and help us to improve our projects.
88

99
If you want to report bugs or suggestions use the [Issue Tracker](https://github.com/EvolSoft/PharTools/issues)
1010

11-
- Please **don't** duplicate issues. Do a small search on current issues before report yours
11+
- Please **do not** duplicate issues. Do a small search on current issues before report yours
1212
- Please provide as more detailed informations as you can about the issue
13-
- Please **don't** post issues related to unofficial source code
14-
- Please **don't** post fake or support issues
13+
- Please **do not** post issues related to unofficial source code
14+
- Please **do not** post fake or support issues
1515
- Please write in english
1616

1717
## Code contributions
1818

1919
If you want to contribute to project's source code simply do a [Pull Request](https://github.com/EvolSoft/PharTools/pull/new). Before doing this **be sure** that:
2020
- The code is clear, correct and follows the current code syntax
21-
- All code comments are written in english
21+
- All code comments are written in English
2222
- You provided a good and descriptive title
23-
- The Pull Request doesn't already exist
23+
- The Pull Request does not already exist

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015, 2018 EvolSoft
3+
Copyright (c) 2015-2018 EvolSoft
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 199 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## PharTools
44

5-
**PharTools** is a powerful PHP-CLI tool to manage phar (PHP-Archive) files. It allows to create, extract, edit and view phar archives. It also includes a simple API to implement PharTools features on your own scripts.
5+
**PharTools** is a powerful PHP command-line tool to manage phar (PHP-Archive) files. It allows to create, extract, edit and view phar archives. It also includes a simple API to implement PharTools features on your own scripts.
66

77
***Features:***
88
- *Create* phar archives
@@ -13,123 +13,255 @@
1313
- *Converts* phar archives to zip or tar archives
1414
- *Supports* GZip and BZip2 compression types (BZip2 needs the php_bz2 extension which is already included on the Windows installer)
1515

16-
***Don't run this script directly. Run it from a cmd.exe or from a Linux Terminal instance instead***
16+
***NOTE: to create phar files you need to set php.readonly to 0 in php.ini configuration***
1717

18-
***If you install PharTools on Windows directories (like Program Files, Program Files (x86), ...) you may need to run cmd.exe as Administrator***
18+
## Requirements
1919

20-
***To create phar files you need to set php.readonly to 0 in php.ini configuration***
20+
- At least PHP 5.3.0
21+
- *Optional:* php_bz2 extension (to implement BZip2 compression support)
2122

22-
## Documentation
23+
## Installation
2324

24-
### Manual configuration
25+
You can download the PharTools packages at [this page](https://www.evolsoft.tk/phartools/download/). You will find three download options:
2526

26-
#### Windows
27+
**All platforms:**
2728

28-
To configure PharTools on Windows you need only to edit *%PHP_PATH%* in *phartools.cmd* file by setting the right php executable path.
29+
PharTools_vx.x.zip (script only)
2930

30-
#### Linux
31+
**Windows:**
3132

32-
On Linux, PharTools usually doesn't require to be configured but if you have some problems, edit *phartools.sh* file.
33+
PharTools_vx.x_win_installer.exe (preconfigured script + precompiled PHP binaries)<br>
34+
PharTools_vx.x_win_portable.zip (preconfigured script + precompiled PHP binaries, no installer)
3335

34-
### Commands
36+
***Please note that precompiled PHP binaries included in the portable and installer pacakages are provided with minimal extensions and configuration***
3537

36-
If you are running PharTools on Windows you can simply run it calling *phartools.cmd* on command shell. On Linux you have to run phartools using *./phartools.sh* instead.
38+
### Windows
3739

38-
###### Example
40+
PharTools installation on Windows is very simple. You have three choices:
41+
- download the installer
42+
- download the Windows portable package
43+
- download the all-platforms zip package and configure PharTools manually
3944

40-
*phartools -h* (Windows)
45+
If choose the third option, you must simply edit the `%PHP_PATH%` variable in `phartools.cmd` file by setting a valid PHP executables path.
4146

42-
*./phartools.sh -h* (Linux)
47+
***NOTE: if you install PharTools on Windows directories (like Program Files, Program Files (x86), ...) you may need administrator privileges in order to run the script correctly.***
4348

44-
#### Add a file to a phar archive:
49+
### Linux
4550

46-
*phartools -a &lt;phar_archive&gt; &lt;file&gt;*
51+
To install PharTools on Linux, download the all-platforms zip package. Then run:
4752

48-
*file* can be either a file or a non-empty directory.
53+
```
54+
$ ./phartools.sh
55+
```
4956

50-
#### Create a phar archive:
57+
It should automatically install the PHP package (if missing) in order to run PharTools correctly or run PharTools directly.
58+
If you have problems while installing the PHP package, try to install it manually from your Linux distro package manager (i.e. *apt-get*).
5159

52-
*phartools -c &lt;destination_phar&gt; &lt;source_dir | source_file&gt; [options]*
60+
### macOS
5361

54-
*options* switches:
62+
You can run PharTools also on macOS. PharTools installation on macOS is very easy: you just need to download the all-platforms zip package. No PHP installation is required because PHP is already bundled with macOS since Mac OS X 10.0.0.
5563

56-
-zgzip|-zbzip2 Compress the phar file using gzip or bzip2 compression<br>
57-
-m&lt;metadata&gt; Add metadata to the phar file (metadata format must be like 'key=&gt;value,key2=&gt;value2')<br>
58-
-s&lt;stub&gt; Set stub string for the phar<br>
59-
-r&lt;regex&gt; Include only files matching the regular expression
64+
## Usage
6065

61-
#### Delete a file from a phar archive:
66+
```
67+
$ phartools -h
6268
63-
*phartools -d &lt;phar_archive&gt; &lt;file&gt;*
69+
Usage:
70+
-a <phar_archive> <files> Add files to a phar archive
71+
-c <phar_archive> <files> [options] Create a phar archive
72+
-d <phar_archive> <file> Delete a file from a phar archive
73+
-e <phar_archive> [extract_path] Extract a phar archive
74+
-h Show this help screen
75+
-i <phar_archive> Show info about a phar archive
76+
-l <phar_archive> List the content of a phar archive
77+
-r <phar_archive> <oldname> <newname> Rename a file inside a phar archive
78+
-a2p <archive> [compression] Convert a zip or tar archive to a phar archive
79+
-p2a <phar_archive> [options] Convert a phar archive to a zip or tar archive
80+
```
6481

65-
*file* can be either a file or a directory.
82+
### -a (add) command
6683

67-
#### Extract a phar archive:
84+
Adds files to a phar archive.
6885

69-
*phartools -e &lt;phar_archive&gt; [extract_path]*
86+
```
87+
$ phartools -a <phar_archive> <files>
88+
```
7089

71-
If *extract_path* is not specified, the archive will be extracted in the current directory
90+
Parameters:
7291

73-
#### Get informations of a phar archive:
92+
```
93+
<phar_archive> is the destination phar archive
94+
<files> are the files you want to add (wildcards are allowed)
95+
```
7496

75-
*phartools -i &lt;phar_archive&gt;*
97+
### -c (create) command
7698

77-
#### List files inside a phar archive:
99+
Creates a phar archive.
78100

79-
*phartools -l &lt;phar_archive&gt;*
101+
```
102+
$ phartools -c <phar_archive> <files> [options]
103+
```
80104

81-
#### Rename a file into a phar archive:
105+
Parameters:
82106

83-
*phartools -r &lt;phar_archive&gt; &lt;oldname&gt; &lt;newname&gt;*
107+
```
108+
<phar_archive> is the name of the resulting phar archive
109+
<files> are the source files to add inside the phar archive (wildcards are allowed)
110+
[options] are optional switches:
111+
-zgzip|-zbzip2 Compress the phar file using gzip or bzip2 compression
112+
-m<metadata> Add metadata to the phar file (metadata format must be like 'key=>value,key2=>value2')
113+
-s<stub> Set stub string for the phar
114+
-r<regex> Include only files matching the regular expression
115+
```
84116

85-
#### Convert zip or tar archive to a phar archive:
117+
### -d (delete) command
86118

87-
*phartools -a2p &lt;archive&gt; [compression]*
119+
Deletes a file from a phar archive.
88120

89-
Currently supported *compression* types are gzip and bzip2
121+
```
122+
$ phartools -d <phar_archive> <file>
123+
```
90124

125+
Parameters:
91126

92-
#### Convert a phar archive to a zip or tar archive:
127+
```
128+
<phar_archive> is the destination phar archive
129+
<file> is the file or the directory you want to delete
130+
```
93131

94-
*phartools -p2a &lt;phar_archive&gt; [options]*
132+
### -e (extract) command
95133

96-
*options* switches:
134+
Extracts a phar archive.
97135

98-
-zgzip|-zbzip2 Set output compression type<br>
99-
-ozip|-otar Set output archive type
136+
```
137+
$ phartools -e <phar_archive> [extract_path]
138+
```
100139

101-
## Available PharTools Downloads
140+
Parameters:
102141

103-
**All platforms:**
142+
```
143+
<phar_archive> is the destination phar archive
144+
[extract_path] is an optional parameter specifying the path on which the phar archive contents will be extracted
145+
```
104146

105-
PharTools_v2.0.zip (Script only)
147+
### -i (show archive info) command
106148

107-
**Windows:**
149+
Shows informations about a phar archive.
150+
151+
```
152+
$ phartools -i <phar_archive>
153+
```
154+
155+
Parameters:
156+
157+
```
158+
<phar_archive> is the destination phar archive
159+
```
160+
161+
It will print:
162+
163+
```
164+
$ phartools -i <phar_archive>
165+
```
166+
167+
### -l (list archive content) command
168+
169+
Lists the content of a phar archive.
170+
171+
```
172+
$ phartools -l <phar_archive>
173+
```
174+
175+
Parameters:
176+
177+
```
178+
<phar_archive> is the destination phar archive
179+
```
180+
181+
### -r (rename) command
182+
183+
Renames a file inside a phar archive.
184+
185+
```
186+
$ phartools -r <phar_archive> <oldname> <newname>
187+
```
188+
189+
Parameters:
108190

109-
PharTools_v2.0_win_installer (Preconfigured Script + Precompiled PHP binaries)<br>
110-
PharTools_v2.0_win_portable (Preconfigured Script + Precompiled PHP binaries, No Installer)
191+
```
192+
<phar_archive> is the destination phar archive
193+
<oldname> is the name of the file to rename
194+
<newfile> is the new filename
195+
```
111196

112-
***Please note that precompiled PHP binaries provided in the Portable and Installer versions are provided with minimal extensions and configuration***
197+
### -a2p (archive to phar archive) command
198+
199+
Converts a zip or tar archive to a phar archive.
200+
201+
```
202+
$ phartools -a2p <archive> [compression]
203+
```
204+
205+
Parameters:
206+
207+
```
208+
<archive> is the zip or tar archive to convert
209+
[compression] is an optional parameter specifying compression:
210+
gzip Compress the phar archive using gzip compression
211+
bzip2 Compress the phar archive using bzip2 compression
212+
```
213+
214+
### -p2a (phar archive to archive) command
215+
216+
Converts a phar archive to a zip or tar archive.
217+
218+
```
219+
$ phartools -p2a <phar_archive> [options]
220+
```
221+
222+
Parameters:
223+
224+
```
225+
<phar_archive> is the destination phar archive
226+
[options] are optional switches:
227+
-zgzip|-zbzip2 Compress the resulting archive file using gzip or bzip2 compression (zip archives do not support compression)
228+
-ozip|-otar Set the output archive format (zip or tar archive)
229+
```
230+
231+
## API
232+
233+
PharTools provides also an API to simplify the usage of phar archives:
234+
235+
```php
236+
include "path/to/phartools.php";
237+
238+
PharTools::<api_function>();
239+
```
240+
241+
*See [documentation](https://www.evolsoft.tk/phartools/docs/) for API functions.*
113242

114243
## Screenshots
115244

116-
#### Windows
245+
### Windows
117246

118-
*1. Open Windows Command Shell*<br>
119-
![1](https://cloud.githubusercontent.com/assets/10297075/7434716/2d8a500c-f03d-11e4-84c2-9ef8ab6fee5d.png)<br>
120-
*2. Go to PharTools directory*<br>
121-
![2](https://cloud.githubusercontent.com/assets/10297075/7434729/61c77962-f03d-11e4-89cb-a78ba782f9be.png)<br>
122-
*3. Run PharTools*<br>
123-
![3](https://cloud.githubusercontent.com/assets/10297075/7434743/7b4bbf06-f03d-11e4-83df-493a92ac7075.png)<br>
247+
*PharTools command-line interface*<br>
248+
![1](https://user-images.githubusercontent.com/10297075/41868510-9143a706-78b6-11e8-859c-b82aaba932ae.png)<br>
249+
*PharTools file list example*<br>
250+
![2](https://user-images.githubusercontent.com/10297075/41868515-92b85a64-78b6-11e8-9113-74c88bc781dd.png)<br>
124251

125-
#### Linux
252+
### Linux
126253

127-
*1. Open Linux Terminal*<br>
128-
![1 2](https://cloud.githubusercontent.com/assets/10297075/7435028/12525408-f040-11e4-8cf5-94f6e1a18bce.png)<br>
129-
*2. Go to PharTools directory*<br>
130-
![2 2](https://cloud.githubusercontent.com/assets/10297075/7435029/12544d12-f040-11e4-9e9b-e6c44740926f.png)<br>
131-
*3. Run PharTools*<br>
132-
![3 2](https://cloud.githubusercontent.com/assets/10297075/7435030/126e09dc-f040-11e4-84f2-d4c19d9ee5ae.png)<br>
254+
*PharTools command-line interface*<br>
255+
![3](https://user-images.githubusercontent.com/10297075/41877166-9814296a-78d0-11e8-9747-dee47fba20b8.png)<br>
256+
*PharTools file list example*<br>
257+
![4](https://user-images.githubusercontent.com/10297075/41877170-9979bc52-78d0-11e8-9ec1-1605cecae28c.png)<br>
258+
259+
### macOS
260+
261+
*PharTools command-line interface*<br>
262+
![5](https://user-images.githubusercontent.com/10297075/41915696-a0ade742-7956-11e8-9efe-e407cd9e2f08.png)<br>
263+
*PharTools file list example*<br>
264+
![6](https://user-images.githubusercontent.com/10297075/41915697-a0d47164-7956-11e8-9457-8969c52076fb.png)<br>
133265

134266
## Donate
135267

@@ -138,6 +270,4 @@ Your generosity will help us paying web hosting, domains, buying programs (such
138270

139271
## Contributing
140272

141-
If you want to contribute to this project please follow the [Contribution Guidelines](https://github.com/EvolSoft/PharTools/blob/master/CONTRIBUTING.md)
142-
143-
273+
If you want to contribute to this project please follow the [Contribution Guidelines](https://github.com/EvolSoft/PharTools/blob/master/CONTRIBUTING.md).

0 commit comments

Comments
 (0)