Skip to content

Commit b4b08b1

Browse files
author
Flavius12
committed
Implemented tons of new features
1 parent 11de6b2 commit b4b08b1

5 files changed

Lines changed: 1095 additions & 347 deletions

File tree

CONTRIBUTING.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ If you want to report bugs or suggestions use the [Issue Tracker](https://github
1212
- Please provide as more detailed informations as you can about the issue
1313
- Please **don't** post issues related to unofficial source code
1414
- Please **don't** post fake or support issues
15-
- Please write in English
15+
- Please write in english
1616

1717
## Code contributions
1818

19-
If you want to contribute on code simply do a [Pull Request](https://github.com/EvolSoft/PharTools/pull/new). Before doing this **be sure** that:
20-
- The code is correct, clear and written in English
19+
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:
20+
- The code is clear, correct and follows the current code syntax
21+
- All code comments are written in english
2122
- You provided a good and descriptive title
22-
- The Pull Request doesn't already exist
23+
- The Pull Request doesn't 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 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: 64 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,112 +1,117 @@
11
![start2](https://cloud.githubusercontent.com/assets/10303538/6315586/9463fa5c-ba06-11e4-8f30-ce7d8219c27d.png)
22

3-
# PharTools
4-
A powerful PHP-CLI tool to create, extract and get info of phar files
3+
## PharTools
54

6-
## Category
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.
76

8-
PHP Command Line Interface script
9-
10-
## Requirements
11-
12-
PHP >= 5.3.0<br>
13-
14-
## Overview
15-
16-
**PharTools** is a powerful PHP-CLI tool to create, extract and get info of phar files
7+
***Features:***
8+
- *Create* phar archives
9+
- *Extract* phar archives
10+
- *Add, rename, delete, list* files inside phar archives
11+
- *Get informations* about phar archives (such as filesize, metadata, stub, etc...)
12+
- *Converts* zip or tar archives to phar archives and vice versa
13+
- *Supports* GZip and BZip2 compression types (BZip2 needs the php_bz2 extension which is already included on the Windows installer)
1714

1815
***Don't run this script directly. Run it from a cmd.exe or from a Linux Terminal instance instead***
1916

20-
***If you install PharTools on Windows directories (like Program Files, Program Files (x86), ...) you need to run cmd.exe as Administrator***
17+
***If you install PharTools on Windows directories (like Program Files, Program Files (x86), ...) you may need to run cmd.exe as Administrator***
2118

2219
***To create phar files you need to set php.readonly to 0 in php.ini configuration***
2320

2421
## Documentation
2522

26-
**Configuration:**
23+
### Manual configuration
2724

28-
###### Windows
25+
#### Windows
2926

30-
To configure PharTools on Windows you need only to edit *%PHP_PATH* and *%PHP_EXE* variables in *phartools.cmd* file where *%PHP_PATH* must be the PHP binaries path and *%PHP_EXE* must be the main PHP executable file (usually *php.exe*)
27+
To configure PharTools on Windows you need only to edit *%PHP_PATH%* in *phartools.cmd* file by setting the right php executable path.
3128

32-
###### Linux
29+
#### Linux
3330

3431
On Linux, PharTools usually doesn't require to be configured but if you have some problems, edit *phartools.sh* file.
3532

36-
**Commands:**
33+
### Commands
34+
35+
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.
3736

38-
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.
37+
###### Example
3938

40-
###### Create Phar:
39+
*phartools -h* (Windows)
4140

42-
To create phar files use the -c command
41+
*./phartools.sh -h* (Linux)
4342

44-
*phartools -c <source_path|source_file> <destination_phar> [options]*
43+
#### Add a file to a phar archive:
4544

46-
**Options:**<br>
47-
-c gzip|bzip2 Compress the phar file using gzip or bzip2 compression<br>
48-
-m <metadata> Add metadata to the phar file (metadata format must be like 'key=>value,key2=>value2')<br>
49-
-s <stub> Set stub string for the phar<br>
50-
-r <regex> Include only files matching the regular expression<br>
45+
*phartools -a <phar_archive> <file>*
5146

52-
**Example:**
47+
*file* can be either a file or a non-empty directory.
5348

54-
phartools -c mysource myphar.phar (Windows)
49+
#### Create a phar archive:
5550

56-
./phartools.sh -c mysource myphar.phar (Linux)
51+
*phartools -c <destination_phar> <source_dir | source_file> [options]*
5752

58-
###### Extract Phar:
53+
*options* switches:
5954

60-
To extract phar files use the -e command
55+
-zgzip|-zbzip2 Compress the phar file using gzip or bzip2 compression
56+
-m<metadata> Add metadata to the phar file (metadata format must be like 'key=>value,key2=>value2')
57+
-s<stub> Set stub string for the phar
58+
-r<regex> Include only files matching the regular expression
6159

62-
*phartools -e <phar_file> [extract_directory]*
60+
#### Delete a file from a phar archive:
6361

64-
If *extract_directory* is not specified, files will be extracted in the current directory
62+
*phartools -d <phar_archive> <file>*
6563

66-
**Example:**
64+
*file* can be either a file or a directory.
6765

68-
phartools -e myphar.phar (Windows)
66+
#### Extract a phar archive:
6967

70-
./phartools.sh -e myphar.phar (Linux)
68+
*phartools -e <phar_archive> [extract_path]*
7169

72-
###### Get Phar Info:
70+
If *extract_path* is not specified, the archive will be extracted in the current directory
7371

74-
To get some infos about a phar file use the -i command. You will get the size, the signature, the signature type, metadata, the stub and some other infos about the specified phar file
72+
#### Get informations of a phar archive:
7573

76-
*phartools -i <phar_file>*
74+
*phartools -i <phar_archive>*
7775

78-
**Example:**
76+
#### List files inside a phar archive:
7977

80-
phartools -i myphar.phar (Windows)
78+
*phartools -l <phar_archive>*
8179

82-
./phartools.sh -i myphar.phar (Linux)
80+
#### Rename a file into a phar archive:
8381

84-
###### Get PharTools Version:
82+
*phartools -r <phar_archive> <oldname> <newname>*
8583

86-
*phartools -v*
84+
#### Convert zip or tar archive to a phar archive:
8785

88-
**Example:**
86+
*phartools -a2p <archive> [compression]*
8987

90-
phartools -v (Windows)
88+
Currently supported *compression* types are gzip and bzip2
9189

92-
./phartools.sh -v (Linux)
90+
91+
#### Convert a phar archive to a zip or tar archive:
92+
93+
*phartools -p2a <phar_archive> [options]*
94+
95+
*options* switches:
96+
-zgzip|-zbzip2 Set output compression type
97+
-ozip|-otar Set output archive type
9398

9499
## Available PharTools Downloads
95100

96101
**All platforms:**
97102

98-
PharTools_v1.0.zip (Only the script)
103+
PharTools_v2.0.zip (Script only)
99104

100105
**Windows:**
101106

102-
PharTools_v1.0_win_installer (Preconfigured Script + Precompiled PHP binaries)
103-
PharTools_v1.0_win_portable (Preconfigured Script + Precompiled PHP binaries, No Installer)
107+
PharTools_v2.0_win_installer (Preconfigured Script + Precompiled PHP binaries)
108+
PharTools_v2.0_win_portable (Preconfigured Script + Precompiled PHP binaries, No Installer)
104109

105110
***Please note that precompiled PHP binaries provided in the Portable and Installer versions are provided with minimal extensions and configuration***
106111

107-
## Usage Example
112+
## Screenshots
108113

109-
###### Windows
114+
#### Windows
110115

111116
*1. Open Windows Command Shell*<br>
112117
![1](https://cloud.githubusercontent.com/assets/10297075/7434716/2d8a500c-f03d-11e4-84c2-9ef8ab6fee5d.png)<br>
@@ -115,7 +120,7 @@ PharTools_v1.0_win_portable (Preconfigured Script + Precompiled PHP binaries, No
115120
*3. Run PharTools*<br>
116121
![3](https://cloud.githubusercontent.com/assets/10297075/7434743/7b4bbf06-f03d-11e4-83df-493a92ac7075.png)<br>
117122

118-
###### Linux
123+
#### Linux
119124

120125
*1. Open Linux Terminal*<br>
121126
![1 2](https://cloud.githubusercontent.com/assets/10297075/7435028/12525408-f040-11e4-8cf5-94f6e1a18bce.png)<br>
@@ -124,6 +129,11 @@ PharTools_v1.0_win_portable (Preconfigured Script + Precompiled PHP binaries, No
124129
*3. Run PharTools*<br>
125130
![3 2](https://cloud.githubusercontent.com/assets/10297075/7435030/126e09dc-f040-11e4-84f2-d4c19d9ee5ae.png)<br>
126131

132+
## Donate
133+
134+
If you want you can support this project with a small donation by clicking [:dollar: here](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=flavius.c.1999@gmail.com&lc=US&item_name=www.evolsoft.tk&no_note=0&cn=&curency_code=EUR&bn=PP-DonationsBF:btn_donateCC_LG.gif:NonHosted).
135+
Your generosity will help us paying web hosting, domains, buying programs (such as IDEs, debuggers, etc...) and new hardware to improve software development. Thank you :smile:
136+
127137
## Contributing
128138

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

phartools.cmd

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
@echo off
2-
3-
::Specify the PHP binaries path here
4-
set PHP_PATH=bin\php
5-
::Specify the main PHP executable here
6-
set PHP_EXE=php.exe
7-
8-
if exist "%PHP_PATH%\%PHP_EXE%" (
9-
"%PHP_PATH%\%PHP_EXE%" phartools.php %*
10-
) else (
11-
echo PHP Executable not found. Please set the right PHP path.
12-
)
1+
@echo off
2+
3+
::Specify the PHP executable path
4+
set PHP_PATH=%~dp0\bin\php\php.exe
5+
6+
if exist "%PHP_PATH%" (
7+
"%PHP_PATH%" %~dp0\phartools.php %*
8+
) else (
9+
echo PHP Executable not found. Please set the right PHP path.
10+
)

0 commit comments

Comments
 (0)