You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-50Lines changed: 6 additions & 50 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,66 +5,22 @@ With this library your users can automatically update their instance of your app
5
5
## Installation
6
6
7
7
* Install the library via composer [visualappeal/php-auto-update](https://packagist.org/packages/visualappeal/php-auto-update)
8
-
* Create a update file/method in your application with your update routine (see `example/client/update/index.php`)
8
+
* Create an update file/method in your application with your update routine (see `example/client/update/index.php`)
9
9
* Create a `update.json` or `update.ini` on your server (where the client should get the updates, see `example/server/update.json` or `example/server/update.ini`)
10
10
11
11
**Important: Please notice that PHP needs write permissions to update the files on the webserver**
12
12
13
13
## Example
14
14
15
-
### Client
15
+
You can start an example docker container via `docker-compose up` and see the example by visiting `http://127.0.0.1:8080/example/client/`
16
16
17
-
#### update.php/some method
17
+
##Client
18
18
19
-
This file will install the update. For an example see `example/client/update/index.php`
19
+
### Caching
20
20
21
-
#### Check for new versions
21
+
The library supports the `desarrolla2/cache` component, and you should use it! Otherwise, the client will download the update ini/json file on every request.
22
22
23
-
You can always check for new versions, e.g. in the footer. This can look like this:
// Download the zip update files to `__DIR__ . '/temp'`
33
-
// Copy the contents of the zip file to the current directory `__DIR__`
34
-
// The update process should last 60 seconds max
35
-
$update = new AutoUpdate(__DIR__ . '/temp', __DIR__, 60);
36
-
$update->setCurrentVersion('0.1.0'); // Current version of your application. This value should be from a database or another file which will be updated with the installation of a new version
37
-
$update->setUpdateUrl('http://php-auto-update.app/update/'); //Replace the url with your server update url
The library supports the `desarrolla2/cache` component and you should use it! Otherwise the client will download the update ini/json file on every request.
66
-
67
-
### Server
23
+
## Server
68
24
69
25
Your server needs at least one file which will be downloaded from the client to check for updates. This can be a json or an ini file. See `example/server/` for examples. The ini section key respectively the json key is the version. This library uses semantic versioning to compare the versions. See [semver.org](http://semver.org/) for details. The ini/json value is the absolute url to the update zip file. Since the library supports incremental updates, the zip file only need to contain the changes since the last version. The zip files do not need to be placed on the same server, they can be uploaded to S3 or another cloud storage, too.
0 commit comments