How to update composer in PHP - php

I'm new to the composer I'm using a plugin here they used composer. I getting some errors that the reason I want to update composer because might be an issue with the composer i'm not sure what is the issue here. my question is in my plugin composer is already installed. Are there any other things I have to install in local?
How should I update this composer used in the plugin?
I'm using this plugin https://github.com/codehaiku/envato-purchase-code-verifier
here I just download the plugin and added my token and API but when I was entered purchase code I was getting an error Invalid Purchase Code. Can anyone suggest me is there any other alternative way to this instead of using this plugin some other plugins?
Any help will be appreciated.

To answer your question as asked:
composer self-update
However, if you're worried that the composer file could be bad download a new version here
If you pay attention to the steps you'll eventually be at one where there's a file called composer.phar in the directory you ran it (probably in your webroot/public_html folder) and then you can be sure you're using the new version by using the command
php composer.phar update
that will update your libraries.
On a potentially more helpful note, contact the vendor as your key may, legitimately, be wrong and/or you purchase an invalid code from a 3rd party.

Related

How to install the Microsoft Azure Storage PHP Client Libraries

I am attempting to install the Microsoft Azure Storage PHP Client Libraries for the first time and am encountering difficulties. I am following the instructions found at https://github.com/Azure/azure-storage-php but I don't find them sufficiently clear. Step 1 under the Install via Composer header says,
Create a file named composer.json in the root of your project and add the following code to it:
{
"require": {
"microsoft/azure-storage-blob": "",
"microsoft/azure-storage-table": "",
"microsoft/azure-storage-queue": "",
"microsoft/azure-storage-file": ""
}
}
There is already a composer.json file in the azure-storage-php directory created by the
git clone https://github.com/Azure/azure-storage-php.git
command. Am I supposed to overwrite the existing composer.json file with the Step 1 instructions? Also, how does my PHP program reference the necessary libraries? I understand I will have use statements like the following code in my PHP program:
use MicrosoftAzure\Storage\Blob\BlobRestProxy;
use MicrosoftAzure\Storage\Common\Exceptions\ServiceException;
use MicrosoftAzure\Storage\Blob\Models\ListBlobsOptions;
use MicrosoftAzure\Storage\Blob\Models\CreateContainerOptions;
use MicrosoftAzure\Storage\Blob\Models\PublicAccessType;
You may rightly discern that I am new to composer installs. It seems to me that the instructions found in https://github.com/Azure/azure-storage-php are not sufficiently clear for a composer novice. Thanks for the help.
I have figured out my problem and it has to do with how I read the installation instructions in https://github.com/Azure/azure-storage-php. There are several bold subtitles and I read Install via Composer as a continuation of Download Source Code when in fact Install via Composer is independent of Download Source Code. Most technical people are familiar with the software installation paradigm of downloading the software and then installing and that is how I thought this was to work. However, the instructions contained in Install via Composer can be followed without performing any of the instructions found in Download Source Code. That is how I got this to work by beginning the installation at Install via Composer and ignoring the previous. I am sure an experience composer user would have known what to do, but for a composer novice I think these instruction could be better written.

What causes Composer not to update to a, modified, existing version?

I've created a v1.0.4 tag for my plug-in and deployer executed composer update on the server. After a short amount of time I've deleted this tag and created it again because this version needed a minor modification.
Now when deployer executes composer update on the server the plug-in is not been updated to the new v1.0.4 (that includes the modification) because the version number is still the same.
I've executed composer clear-cache on the server but this does not seem to work. Is this even possible or was it better to create a new version for this modification?
The modified tag v1.0.4 is present in the repository. Any help is appreciated.
Please tag your plugin properly as a new version. If v1.0.4 of it is already installed, the commit hash used by that tag is stored in composer.lock, and getting this fixed might lead to more problems popping up.

How can I deploy static web app on Heroku

I followed instructions from an answer of a similar topic(https://stackoverflow.com/a/17531897/4388482). Well, my app is getting deployed on Heroku but it doesn't work good. I'm getting the following warning
Your project only contains an 'index.php', no 'composer.json'.
Using 'index.php' to declare app type as PHP is deprecated and may lead to unexpected behavior.
Do I need to install something maybe?
UPDATE
Project structure was initially this:
I did the following:
Installed PHP 5 and composer.
I renamed package.json to composer.json and removed package-lock.json.
Typed "composer update" command. I got "nothing to install or update" message.
Added vendor to gitignore. Pushed changes to heroku.
I got the following warnings
Your 'composer.lock' is out of date!
Composer vendor dir found in project!
The complaint that Heroku has is regarding this folder.
For the record, the contents of this folder presently are:
bootstrap
fontawesome-free
jquery-easing
jquery
What has happened here is that someone has committed dependencies to your version control, which is not good practice. It will work as is, but it is not very easy to do upgrades, especially since you cannot easily see what versions you currently do have.
There are three ways to go about this.
Decide if these are PHP dependencies, by searching Packagist. There is a Composer dependency for Bootstrap, but you would need to see if the version you are using is available (or whether you can upgrade to one that is available).
Decide if these are JavaScript dependencies, by searching NPM. I wonder if it is worth examining the contents of your package.json in case these are already covered. For what it is worth, I would generally consider these candidates for JavaScript libraries rather than PHP, but do what works for you.
Choose to leave these dependencies committed in the existing vendor folder. It will work, but it is not ideal for the reasons already stated.
In the last two cases, you could probably get away with a composer.json file thus, which you should commit to the repo:
{
"require": {
}
}
You could try a composer install after this, to see if it will generate a .lock file on an empty dependency list. If this does generate, then you should commit this also.

How to update CakePHP?

I have to update CakePHP from current, outdated version (2.7.7) to latest on 2 branch, because of PHP7 support.
While I've done numerous framework upgrades before, I found book.cakephp.org a more than a cryptic about key things which I ask here:
can it be done by replacing directoris
which directories are intended to be replaced (never edit dirs, like system in Codeigniter)
which directories are partially replaced if any
is there SQL commands that should be run?
is there other commands that should be run?
Any clue is appreciated, but 2 and 3 are of most value I guess. Thanks in advance.
Depending on how you've installed CakePHP, you either use composer to update the CakePHP core dependency:
$ composer update
or require a specific constraint/version if your current constraint doesn't allow upgrading:
$ composer require cakephp/cakephp:^2.10.3
If you're not using composer (I'd suggest to switch to using it), then you download the latest release package manually, and completely replace the /lib/Cake directory. With respect to the core, the upgrade is then complete.
Then read the migration guides to figure the possible changes that you have to apply to your application code or database schemas, and also compare the "application template" changes (/app/) to your local application and apply changes in case necessary. After this, run your test suite to ensure that everything works as expected.
With that being said, the upgrade from 2.7 to the latest 2.10 should be pretty easy, as it is said to be fully API compatible.
I recommend you to use composer to manage your framework and extensions.
With composer installed, it would be much easier to update. If you decide to use composer, let me know if you need any more help by installation, setup or update.

Trouble installing Omnipay via Netbeans composer extension

I am currently trying to install Omnipay into my Codeigniter project. I am stuck on windows because I do not have ssh access to the box where this needs to run on. So far I have gotten a new directory in the project root that is named "vendor" and it contains a lot of empty directories referring to Symfony (for what reason is beyond me).
Then I get a runtime exception that I need to enable the openssl extension in my php to download the necessary files and this is where I am stuck at. I don't run WAMP on my computer and I just use the php.exe I downloaded to work with netbeans.
Isn't there an easier way to get omnipay to run? Like just download the files from somewhere and plug them into my project like normal? It seems to be an aweful lot of headache to get a simple library to run in my CI project.
Please forgive my ignorance towards composer but I currently see no benefit of using it for this particular project.
You can "just download" the files here: https://github.com/omnipay/common/archive/master.zip
The problem is, Omnipay depends on Guzzle (an HTTP library), and Guzzle depends on some Symfony components. So you will spend the rest of the day downloading dependencies and making sure you have all the necessary files. That is the problem Composer solves for you.
I don't have any experience running Composer on Windows, but I would start here:
http://getcomposer.org/doc/00-intro.md#installation-windows
Using the Installer
This is the easiest way to get Composer set up on your machine.
Download and run Composer-Setup.exe, it will install the latest
Composer version and set up your PATH so that you can just call
composer from any directory in your command line.
Once you have Composer installed, you should simply be able to make a file named composer.json in your project root, with the following contents:
{
"require": {
"omnipay/omnipay": "~2.0"
}
}
Then use the Command Prompt and cd to your project's directory, and run composer update to download the Omnipay files and all their dependencies.

Categories