Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/navarr/easy-upgrades
A simple trait to make it easier to upgrade things
https://github.com/navarr/easy-upgrades
Last synced: about 7 hours ago
JSON representation
A simple trait to make it easier to upgrade things
- Host: GitHub
- URL: https://github.com/navarr/easy-upgrades
- Owner: navarr
- License: mit
- Created: 2016-08-30T14:57:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-08-31T16:22:37.000Z (about 8 years ago)
- Last Synced: 2024-09-21T14:12:03.421Z (about 2 months ago)
- Language: PHP
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Easy Upgrades!
"Wow, I didn't know I needed this" - Everyone, ever
## How to install
composer require navarr/easy-upgrades
> Holy crap, that's it?OF COURSE IT IS! What year do you think it is?!
## How to use
In your class, `use CallableUpdateTrait;`, like so:
class SomeCrappyClass
{
use CallableUpdateTrait;
public function somethingTriggeredExternally($currentVersion, $futureVersion)
{
$this->runAt('2.0.0', $currentVersion, function() {
echo 'Hello, 2.0.0!',PHP_EOL;
});
}
}
Basically, using CallableUpdateTrait gives you the `runAt` method. Neat stuff!## Wait, this only contains one class that does practically nothing
Yes, but now you don't have to write it into every project, or every module, or whatever.
## Why this?
It's a common function I wish I had in Magento 2 - so I made it. It doesn't need Magento, or have any dependencies. It just does what it says on the tin.