{"id":19543876,"url":"https://github.com/benjpaddock/laravel-selfupdater","last_synced_at":"2026-05-16T19:04:11.972Z","repository":{"id":254322721,"uuid":"846188817","full_name":"benjpaddock/laravel-selfupdater","owner":"benjpaddock","description":"This package provides some basic methods to implement a self updating functionality for your Laravel application. Already bundled are some methods to provide a self-update mechanism via Github or some private repository via http.","archived":false,"fork":false,"pushed_at":"2024-11-20T16:52:33.000Z","size":1032,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-08T19:13:57.273Z","etag":null,"topics":["laravel","laravel-package","laravel-selfupdater","php","self-updater","updater"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benjpaddock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"codedge"}},"created_at":"2024-08-22T17:45:04.000Z","updated_at":"2024-08-22T18:13:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"5277a4e9-76ad-4e15-8977-2f8f6fc41a5b","html_url":"https://github.com/benjpaddock/laravel-selfupdater","commit_stats":null,"previous_names":["benjpaddock/laravel-selfupdater"],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjpaddock%2Flaravel-selfupdater","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjpaddock%2Flaravel-selfupdater/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjpaddock%2Flaravel-selfupdater/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benjpaddock%2Flaravel-selfupdater/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benjpaddock","download_url":"https://codeload.github.com/benjpaddock/laravel-selfupdater/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240799171,"owners_count":19859511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","laravel-package","laravel-selfupdater","php","self-updater","updater"],"created_at":"2024-11-11T03:22:53.006Z","updated_at":"2026-05-16T19:04:06.941Z","avatar_url":"https://github.com/benjpaddock.png","language":"PHP","funding_links":["https://github.com/sponsors/codedge"],"categories":[],"sub_categories":[],"readme":"# Laravel Application Self-Updater\n\n[![Latest Stable Version](https://poser.pugx.org/codedge/laravel-selfupdater/v/stable?format=flat-square)](https://packagist.org/packages/codedge/laravel-selfupdater)\n[![Total Downloads](https://poser.pugx.org/codedge/laravel-selfupdater/downloads?format=flat-square)](https://packagist.org/packages/codedge/laravel-selfupdater)\n[![](https://github.com/codedge/laravel-selfupdater/workflows/Tests/badge.svg)](https://github.com/codedge/laravel-selfupdater/actions)\n[![StyleCI](https://styleci.io/repos/64463948/shield)](https://styleci.io/repos/64463948)\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/dd836e58656b4e25b34b2a4ac8197142)](https://www.codacy.com/app/codedge/laravel-selfupdater?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=codedge/laravel-selfupdater)\n[![codecov](https://codecov.io/gh/codedge/laravel-selfupdater/branch/master/graph/badge.svg)](https://codecov.io/gh/codedge/laravel-selfupdater)\n\nThis package provides some basic methods to implement a self updating\nfunctionality for your Laravel application.\n\n**Supported update provider:**\n\n-   GitHub\n-   Gitlab\n-   Gitea\n-   Http-based archives\n\nUsually you need this when distributing a self-hosted Laravel application\nthat needs some updating mechanism without [Composer](https://getcomposer.org/).\n\n## Install\n\nTo install the latest version from the master using [Composer](https://getcomposer.org/):\n\n```sh\ncomposer require codedge/laravel-selfupdater\n```\n\n## Configuration\n\nAfter installing the package you need to publish the configuration file via\n\n```sh\nphp artisan vendor:publish --provider=\"Codedge\\Updater\\UpdaterServiceProvider\"\n```\n\n**Note:** Please enter correct value for vendor and repository name in your `config/self-updater.php` if you want to use Github as source for your updates.\n\n### Setting the currently installed version\n\nBefore starting an update, make sure to set the version installed correctly.\nYou're responsible to set the current version installed, either in the config file or better via the env variable `SELF_UPDATER_VERSION_INSTALLED`.\n\n#### `tag`-based updates\n\nSet the installed version to one of the tags set for a release.\n\n#### `branch`-based updates\n\nSet the installed version to a datetime of one of the latest commits.  \nA valid version would be: `2020-04-19T22:35:48Z`\n\n### Running artisan commands\n\nArtisan commands can be run before or after the update process and can be configured in `config/self-updater.php`:\n\n**Example:**\n\n```php\n'artisan_commands' =\u003e [\n    'pre_update' =\u003e [\n        'updater:prepare' =\u003e [\n            'class' =\u003e \\App\\Console\\Commands\\PreUpdateTasks::class,\n            'params' =\u003e []\n        ],\n    ],\n    'post_update' =\u003e [\n        'postupdate:cleanup' =\u003e [\n            'class' =\u003e \\App\\Console\\Commands\\PostUpdateCleanup::class,\n            'params' =\u003e [\n                'log' =\u003e 1,\n                'reset' =\u003e false,\n                // etc.\n            ]\n        ]\n    ]\n]\n```\n\n### Configure the download path\n\nSometimes your web host does not allow saving files into the `/tmp` folder of the server. You can change the folder the application is downloaded to by setting the\nenv var `SELF_UPDATER_DOWNLOAD_PATH` to something different. Just keep in mind, that the folder is not inside the folder your application lives in as it might be overwritten\nduring the update.\n\n### Notifications via email\n\nYou need to specify a recipient email address and a recipient name to receive\nupdate available notifications.\nYou can specify these values by adding `SELF_UPDATER_MAILTO_NAME` and\n`SELF_UPDATER_MAILTO_ADDRESS` to your `.env` file.\n\n| Config name                                  | Description                       |\n| -------------------------------------------- | --------------------------------- |\n| SELF_UPDATER_MAILTO_NAME                     | Name of email recipient           |\n| SELF_UPDATER_MAILTO_ADDRESS                  | Address of email recipient        |\n| SELF_UPDATER_MAILTO_UPDATE_AVAILABLE_SUBJECT | Subject of update available email |\n| SELF_UPDATER_MAILTO_UPDATE_SUCCEEDED_SUBJECT | Subject of update succeeded email |\n\n### Private repositories\n\nPrivate repositories can be accessed via (Bearer) tokens. Each repository inside the config file should have\na `private_access_token` field, where you can set the token.\n\nℹ Do not prefix the token with `Bearer `. This is done automatically.\n\n## Usage\n\nTo start an update process, i. e. in a controller, just use:\n\n```php\nRoute::get('/', function (\\Codedge\\Updater\\UpdaterManager $updater) {\n\n    // Check if new version is available\n    if($updater-\u003esource()-\u003eisNewVersionAvailable()) {\n\n        // Get the current installed version\n        echo $updater-\u003esource()-\u003egetVersionInstalled();\n\n        // Get the new version available\n        $versionAvailable = $updater-\u003esource()-\u003egetVersionAvailable();\n\n        // Create a release\n        $release = $updater-\u003esource()-\u003efetch($versionAvailable);\n\n        // Run the update process\n        $updater-\u003esource()-\u003eupdate($release);\n\n    } else {\n        echo \"No new version available.\";\n    }\n\n});\n```\n\nCurrently, the fetching of the source is a _synchronous_ process. It is not run in background.\n\n### Using GitHub\n\nThe package comes with a _GitHub_ source repository type to fetch\nreleases from GitHub - basically use GitHub to pull the latest version\nof your software.\n\nJust make sure you set the proper repository in your `config/self-updater.php`\nfile.\n\n#### Tag-based updates\n\nThis is the default. Updates will be fetched by using a tagged commit, aka release.\n\n#### Tag-based updates with assets/package file\n\nIf you have pre-packaged _tag based_ releases, you can use the `'repository_types.github.package_file_name'` key in your\n`config/self-update.php` file or update the `SELF_UPDATER_PACKAGE_FILE_NAME` `.env` var to specify the asset name to\ndownload.\n\nIf you prefix the file name with `regex:` the package will try to find the latest asset matching the given regex. Note\nhowever to use only the regex and not the PHP regex `/` prefix and suffixes. For example, an acceptable value would be\n`regex:.releaseV*\\.zip`. This will match all assets starting with `releaseV` and ending with `.zip`.\n\nAn invalid value would be `regex:/releaseV*\\.zip/`. Note the `/` prefix and suffix.\n\n```php\n// ...\n'repository_types' =\u003e [\n    'github' =\u003e [\n        'type' =\u003e 'github',\n        'repository_vendor' =\u003e env('SELF_UPDATER_REPO_VENDOR', ''),\n        'repository_name' =\u003e env('SELF_UPDATER_REPO_NAME', ''),\n        // ...\n        'package_file_name' =\u003e 'release.zip', // Package file name to download\n        'package_file_name' =\u003e 'regex:releaseV.*\\.zip', // REGEX Package file name to download\n   ],\n   // ...\n];\n```\n\n#### Branch-based updates\n\nSelect the branch that should be used via the `use_branch` setting [inside the configuration](https://github.com/codedge/laravel-selfupdater/blob/master/config/self-update.php).\n\n```php\n// ...\n'repository_types' =\u003e [\n    'github' =\u003e [\n        'type' =\u003e 'github',\n        'repository_vendor' =\u003e env('SELF_UPDATER_REPO_VENDOR', ''),\n        'repository_name' =\u003e env('SELF_UPDATER_REPO_NAME', ''),\n        // ...\n        'use_branch' =\u003e 'v2',\n   ],\n   // ...\n];\n```\n\n### Using Gitlab\n\nConfigure Gitlab either via the `config/self-updater.php` or use the appropriate environment variables.\n\n```php\n// ...\n'repository_types' =\u003e [\n    'gitlab' =\u003e [\n            'base_url'             =\u003e '',\n            'type'                 =\u003e 'gitlab',\n            'repository_id'        =\u003e env('SELF_UPDATER_REPO_URL', ''),\n            'download_path'        =\u003e env('SELF_UPDATER_DOWNLOAD_PATH', '/tmp'),\n            'private_access_token' =\u003e env('SELF_UPDATER_GITLAB_PRIVATE_ACCESS_TOKEN', ''),\n   ],\n   // ...\n];\n```\n\nℹ Although the environment variable is named `SELF_UPDATER_REPO_URL`, only specify your repository id.\n\nFor self-hosted Gitlab instances you can set the `base_url` variable to a domain where the instance is hosted at, f. ex. `http://gitlab.acme.local`.\n\n### Using HTTP archives\n\nThe package comes with an _HTTP_ source repository type to fetch\nreleases from an HTTP directory listing containing zip archives.\n\nTo run with HTTP archives, use following settings in your `.env` file:\n\n| Config name                      | Value / Description                        |\n| -------------------------------- | ------------------------------------------ |\n| SELF_UPDATER_SOURCE              | `http`                                     |\n| SELF_UPDATER_REPO_URL            | Archive URL, e.g. `http://archive.webapp/` |\n| SELF_UPDATER_PKG_FILENAME_FORMAT | Zip package filename format                |\n| SELF_UPDATER_DOWNLOAD_PATH       | Download path on the webapp host server    |\n\nThe archive URL should contain nothing more than a simple directory listing with corresponding zip-Archives.\n\n`SELF_UPDATER_PKG_FILENAME_FORMAT` contains the filename format for all webapp update packages. I.e. when the update packages listed on the archive URL contain names like `webapp-v1.2.0.zip`, `webapp-v1.3.5.zip`, ... then the format should be `webapp-v_VERSION_`. The `_VERSION_` part is used as semantic versionioning variable for `MAJOR.MINOR.PATCH` versioning. The zip-extension is automatically added.\n\nThe target archive files must be zip archives and should contain all files on root level, not within an additional folder named like the archive itself.\n\n### Using Gitea\n\nWith _Gitea_ you can use your own Gitea-Instance with tag-releases.\n\nTo use it, use the following settings in your `.env` file:\n\n| Config name                             | Value / Description                     |\n| --------------------------------------- | --------------------------------------- |\n| SELF_UPDATER_SOURCE                     | `gitea`                                 |\n| SELF_UPDATER_GITEA_URL                  | URL of Gitea Server                     |\n| SELF_UPDATER_REPO_VENDOR                | Repo Vendor Name                        |\n| SELF_UPDATER_REPO_NAME                  | Repo Name                               |\n| SELF_UPDATER_GITEA_PRIVATE_ACCESS_TOKEN | Access Token from Gitea                 |\n| SELF_UPDATER_DOWNLOAD_PATH              | Download path on the webapp host server |\n\n## Contributing\n\nPlease see the [contributing guide](CONTRIBUTING.md).\n\n## Licence\n\nThe MIT License (MIT). Please see [Licence file](LICENSE) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjpaddock%2Flaravel-selfupdater","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenjpaddock%2Flaravel-selfupdater","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenjpaddock%2Flaravel-selfupdater/lists"}