I've been trying to install and use composer for a "php sql parser" code (available here).
I've installed composer with the windows package. However, ater reading 3 tutorials, I'm not sure on what to do next. I think I should create a .json file somewhere and use command line after that. But nothing more precise.
Related
I am trying to ask the question as precisely as possible but I myself have lots of confusion about this. So please bear with me
Problem - We have a third party API (Recurly) installed in our site. That site was built with Laravel. The version of that API is now outdated and I want to update the version via composer.
From the Recurly I have got the following instruction to upgrade the version
In composer.json file update the line of code from "recurly/recurly-client": "2.8." to "recurly/recurly-client": "2.12. . And this will upgrade your client library AND your API version.
Once you do this, please run a composer update in your terminal->active directory w/ Recurly and it will update you:
I have updated the line inside composer.json file. But I dont understand the second part of the instruction. How to run a composer update. Shall I update the composer itself? But I want to update the Recurly API version. is it necessary to update the composer itself?
I have found this link: https://getcomposer.org/doc/03-cli.md#update-u
In this link its written
In order to get the latest versions of the dependencies and to update the composer.lock file, you should use the update command. This command is also aliased as upgrade as it does the same as upgrade does if you are thinking of apt-get or similar package managers.
php composer.phar update
I am not sure Is this the command I need?
Our webserver is with AWS. And we have WHM and cPanel installed to manage the web server.
I understand my question is not not precise as expected . but I cant figure out where to start actually. Please suggest me accordingly
As composer update command can create additional problem to the server hence i have run composer update only for Recurly as a root
composer update recurly/recurly-client
It is important to run the command from the directory where the composer.lock and composer.json files are
for an example if you have several sites under your server and if you run the command as root it may affect other sites as well.
To prevent that first you have to run
cd /home/websitefolder
then
composer update recurly/recurly-client
This way you can update only single package and it will not affect the rest of your site
There are two approaches to solving your problem,
Option A
as was stated, go to your composer.json and update the line
go to Terminal at the cpanel, should you not have terminal, use option 2
cd into your directory and run php composer update, (please before doing this, make sure to have a copy of your composer.json and the lock files.
Option B (No Terminal at cpanel)
Zip your directory and download
copy the file after unzipping to your wamp/xamp directory
edit the composer.json
and run php composer update (things can break here, I think the best is to run composer install rather than update)
zip and upload the file back.
I believe that should solve the problem
Maybe just a stupid question.
After I download/clone composer source code from github.com, how can I run it or compile it into a phar file?
When running "php bin/composer -v", it shows such errors:
php bin/composer -v
You must set up the project dependencies using `composer install`
See https://getcomposer.org/download/ for instructions on installing Composer
Is it said that I must download another composer.phar file and run "php composer.phar install" first?
I think it is a recursive way, "composer" itself is managed by composer :(
At first: if someone wants just to use composer, they must not install it from GitHub, just follow the installation guide: https://getcomposer.org/download/
OK, back to the question.
"composer" itself is managed by composer
Yes, and why do you think it is bad?
See the official documentation for contributors. It encourages exactly that way:
Run git clone https://github.com/composer/composer.git
Download the composer.phar executable
Run Composer to get the dependencies: cd composer && php ../composer.phar install
Then you can actually use composer by launching bin/composer, or you can compile it into phar by bin/compile.
If you wonder how are composer binaries actually built, you can see it in their Travis config. They just grab previous composer release provided by Travis, and build new composer release with it.
Composer's job is to locate and install dependencies for a particular project. Everything it does could be done by hand, mostly simply by placing files in the right location, and referencing a series of autoloaders.
In order to build Composer from scratch, you need certain code that is outside of the main Composer repository, such as command-line and logging helpers. You could download all of these manually, but the natural way is to use an existing install of Composer to fetch them.
This is only necessary if you are working on Composer itself, because once you have a successful build, you can produce a PHAR file, which contains all the required code including those third-party dependencies. These are the files distributed as official releases, and are all most people need; the tool even has a self-update command which downloads a new PHAR file and overwrites the one you ran.
This kind of bootstrapping - using an existing build of a tool as part of its own build process - is actually quite common. There are some parts of PHP itself which are generated using a PHP script, and I believe the first feature-complete C++ compiler was written in C++.
I am trying to install Symfony on CentOS Linux wih PHP 5.6 and cPanel installed.
When I run composer require symfony/assetic-bundle , once adding bundle to the AppKernelphp, symfony (app/console too) stops working and keeps logging this error:
[10-Jun-2016 22:00:57 UTC] PHP Fatal error: Class 'Symfony\Bundle\AsseticBundle\AsseticBundle' not found in /home/avid24/public_html/app/AppKernel.php on line 19
After checking the vendor directory, turns out that composer has downloaded a single compressed file with a random name, I could extract it with unzip. but problem still exists!
This environment works properly on windows and I could easily update symfony and its components using composer.
Any help? Anyone with the same experience ?
Well, I eventually figured out the problem!
I enabled suhosin extension which prevents the composer and other similar command prompt php scripts from a proper execution.
As a temporary solution I copied php.ini and disabled unnecessary extensions and put it next to my project and call composer this way
$php -c ../composer-php.ini ~/composer ......
I'll create a script to make the life easier
I didn't find any resource which describes coexistence of composer and suhosin extension, so I'm not sure if this is the ultimate solution but the root cause is identified.
If anybody makes workaround this subject I'd be more than happy to know about it.
I need to install CakePHP 3 in an old-fashioned upload-unzip-run way.
The archive I've downloaded from cakephp/cakephp/tags does not contain the default folders like webroot, Model etc., which means it's not complete.
The official documentation does not cover this. Here's a relevant Github issue I found, but the person ends up still using Composer.
There's also cakephp/app and it seems to include those missing files, but it's not mentioned in cakephp/cakephp's composer.json, and even if I download it I've no idea how to merge the packages.
Packaged app (cakephp/app) releases that include all dependencies (framework (cakephp/cakephp), standard CakePHP plugins (cakephp/debugkit, cakephp/bake, etc), required third party libraries) can be found on GitHub.
https://github.com/cakephp/cakephp/releases
It's the download with the small package symbol, named like cake-3-x-x.zip.
However, it isn't a good idea to ditch the dependency manager, as keeping the code base and the autoloader up to date will be rather tedious, and, no offense, I have my doubts that you'll be able to handle this properly if you don't even know how to stitch the app and cake packages together.
You can install CakePhp 3 without Composer.
You need minimum requirements to install CakePhp 3 and CakePhp 3 boilerplate ( fresh copy of Cakephp 3 ).
You can download CakePhp 3 boilerplate from github.
Requirements
Server
HTTP Server. For example: Apache. Having mod_rewrite is preferred,but by no means required.
PHP 5.4.16 or greater.
mbstring extension
intl extension
Database :
MySQL (5.1.10 or greater)
PostgreSQL
Microsoft SQL Server (2008 or higher)
SQLite 3
All built-in drivers require PDO. You should make sure you have the correct PDO extensions installed.
CakePhp 3 Boilerplate:
Repository Home
https://github.com/cakephp/cakephp/releases
CakePhp 3.1.4
https://github.com/cakephp/cakephp/releases/download/3.1.4/cakephp-3-1-4.zip
CakePhp 3.0.15
https://github.com/cakephp/cakephp/releases/download/3.0.15/cakephp-3-0-15.zip
Download one repository and unzip where you wanted to install it.
You may get one error like ( you may not get error if you are lucky!)
Fatal Error
Cake\Error\FatalErrorException
Error: Class 'Cake\Mailer\Email' not found
File D:\xampp\htdocs\practice\cakephp\cakephp-3-1-4\config\bootstrap.php
Line: 138
Then you have to comment two line in config/bootstrap.php
//Email::configTransport(Configure::consume('EmailTransport'));
//Email::config(Configure::consume('Email'));
And finally you got CakePhp 3 installed.
[I am also new in CakePhp 3.So Please inform me if there are any wrong in my given process.]
Thanks
Use Composer.
Install Composer locally, follow the Cake installation instructions, then upload the created folders to the target webhost.
Easy, For CakePHP 3.x you can just download the release you want from here
https://github.com/cakephp/cakephp/releases (eg. https://github.com/cakephp/cakephp/releases/tag/3.3.16).
For a complete installation select the first download link (.zip)
the other links are just for the src
Just run this command to get a clone of CakePHP 3.10.0
git clone -b 3.x git://github.com/cakephp/cakephp.git
Try simple steps
1. Download XAMPP Server.
2. Install XAMPP server.
3. Go to ..\xampp\php\php.ini and open.
4. Add this line (extension=php_intl.dll) or if exist uncomment.
5. Download Composer setup from https://github.com/composer/windows-setup/releases/
6. Install composer and give php.exe file in path
7. Open cmd and check now php version using command php -v. if its showing php version its means its working.
8. Now open cmd and cd on xampp\htdocs folder & run command composer create-project --prefer-dist cakephp/app app_name
9. Finished folder created in htdocs.
Composer is a tool for dependency management in PHP projects. It allows you to declare the dependent libraries your project needs and it will install them in your project for you. Composer is not a package manager.
I told this to declare my meaning from Composer. Recently I have tried to run my first Google API project. There is a quickStart witch tells I need to use Composer. So I tried to run composer using php composer.phar install, but the only output I got was some question marks ???????, and no dependencies where fetched. I haven't noticed anything special about composer itself, it seems that there must be something with .phar files that I don't know. Is there anything special in the architecture of phar files? What should I do?
I googled a lot, but there was nobody having the same problem as mine.
The issue you describe sounds like you have detect_unicode enabled in your php.ini. You should disable it because it really is of no use and creates problems with phars.
By the way using the composer installer would do a check of settings and warn you about such problems.
php -d detect_unicode=Off composer.phar install
fixed it on MacOS X, it seems to reset my php.ini every now and then
Coming pretty late to this question, but I'd like to add that you can always run this command to verify php is configured correctly for Composer
curl -s https://getcomposer.org/installer | php -- --check
That will let you know if anything needs to be amended. If you get a blank output from Composer, that's the first place to go for help.