Skip to content

Commit 5f69d32

Browse files
authored
update README.md
1 parent ca68717 commit 5f69d32

File tree

1 file changed

+35
-1
lines changed

1 file changed

+35
-1
lines changed

README.md

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,85 @@
11
# GitHub Release Updater
2+
23
The GitHub Release Updater is a PHP class that enables you to update your project from the latest GitHub repository releases. The class is simple to use and highly efficient in keeping your project up-to-date with the latest releases.
34

45
## Preparation
6+
57
Before using this class, you need to generate a personal access token on GitHub. Follow these steps:
68

79
- Go to https://github.com/settings/tokens/new
810
- Select the repository and enable read-only access for Contents and Metadata.
911
- Click on "Generate token" and copy the token.
1012

1113
## Installation
14+
1215
To use this class with Composer, follow these steps:
1316
- Open a terminal or command prompt in your project's root directory.
1417
- Run the following command to initialize a composer.json file in your project:
18+
1519
```
1620
composer init
1721
```
22+
1823
- Follow the prompts to fill out the details for your project (e.g. package name, description, author, etc.).
1924
- Run the following command to install the koderzi/php-github-updater package:
25+
2026
```
2127
composer require koderzi/php-github-updater
2228
```
29+
2330
This will download the package and its dependencies and add them to your vendor directory.
31+
2432
- Include the vendor/autoload.php file in your project's to autoload the class provided by the package:
33+
2534
```
2635
require_once "vendor/autoload.php";
2736
```
37+
2838
If you're using a framework or other autoloading mechanism, you may not need to include this file manually.
39+
2940
To use this class with direct download, follow these steps:
41+
3042
- Retrieve the Updater.php file from the src directory in the repository.
3143
- Put the Updater.php file in your project's directory.
3244
- include the file to your project's to load the class.
3345

3446
## Usage
47+
3548
To initialize the Updater class and start the update process, follow these steps:
3649
- Instantiate the GitUpdate class with the following parameters:
50+
3751
```
3852
use KoderZi\PhpGitHubUpdater\Updater;
3953
40-
new Updater($username, $repository, $token, $version, $admin, $mailer);
54+
new Updater(
55+
string $username,
56+
string $repository,
57+
string $token,
58+
string $version,
59+
string $admin,
60+
string $mailer,
61+
array $exclude = ['path' => [], 'filename' => []]
62+
);
4163
```
64+
4265
>- __$username__: Your GitHub username.
4366
>- __$repository__: The name of your GitHub repository.
4467
>- __$token__: The personal access token you generated earlier.
4568
>- __$version__: The current version number of your project.
4669
>- __$admin__: The email address of the admin who will receive an email in case of update failure.
4770
>- __$mailer__: The email address that the email will be sent from.
71+
>- __$exclude__: (Optional) An array of directories or files to exclude from the update.
72+
```
73+
// The $exclude array must have the format:
74+
$exclude =
75+
[
76+
'path' => [],
77+
'filename' => []
78+
]
79+
```
80+
4881
If a new release is available, the class will update your project automatically.
4982

5083
## Conclusion
84+
5185
The GitHub Release Updater is a simple and efficient way to keep your project up-to-date with the latest releases on GitHub. It is easy to use and can save you a lot of time and effort. If you have any questions or issues, please feel free to contact us.

0 commit comments

Comments
 (0)