Xampp / Composer / Zend Framework 2 Installation issues - php

Ok, so I have a composer.json file, a composer.lock file, and a composer.phar file. All the info I need to install Zend Framework I believe is in the .json file, however I have no idea what I'm doing with composer, and have no idea how to use the .phar file. If someone out there can help me out, I would be super great-full. I've been reading tutorials, and watching videos but I'm fairly new to the technical side of php. I've never worked with libraries, or command prompts, so this is all WAY over head.

Here is a start:
http://getcomposer.org/doc/00-intro.md
Step one: Download composer.phar
$ curl -sS https://getcomposer.org/installer | php
Step Two:
$ php composer.phar install
That will download all the file dependencies outlined in the composer.json file.
A couple notes:
Above assumes you are using a bash prompt (Linux or cygwin on windows) If your not using linux you can download composer.phar from getcomposer.org.
You have php in your system path meaning that when you type php in your command line it will run the php executable/binary.

Related

cs-cart add on giving error cscart-sdk is not recognized

I have developed a cs cart add on, But when I make a zip of it and try to upload it from gui it gives wrong structure data
so after little research I got that, I have to follow some steps of given in following url.
https://github.com/cscart/sdk
But after successful installation of composer, When I run the command
cscart-sdk command:name
It gives me error
cscart-sdk is not recognized as an internal or external command
I am very new to cscart add-on development
There seems to be something wrong with your composer install, please follow this tutorial (this is where cscart also relates to)
Installation - Linux / Unix / OSX#
Downloading the Composer Executable#
Composer offers a convenient installer that you can execute directly from the commandline. Feel free to download this file or review it on GitHub if you wish to know more about the inner workings of the installer. The source is plain PHP.
There are in short, two ways to install Composer. Locally as part of your project, or globally as a system wide executable.
Locally#
Installing Composer locally is a matter of just running the installer in your project directory. See the Download page for instructions.
The installer will just check a few PHP settings and then download composer.phar to your working directory. This file is the Composer binary. It is a PHAR (PHP archive), which is an archive format for PHP which can be run on the command line, amongst other things.
Now just run php composer.phar in order to run Composer.
You can install Composer to a specific directory by using the --install-dir option and additionally (re)name it as well using the --filename option. When running the installer when following the Download page instructions add the following parameters:
php composer-setup.php --install-dir=bin --filename=composer
Now just run php bin/composer in order to run Composer.
Globally#
You can place the Composer PHAR anywhere you wish. If you put it in a directory that is part of your PATH, you can access it globally. On unixy systems you can even make it executable and invoke it without directly using the php interpreter.
After running the installer following the Download page instructions you can run this to move composer.phar to a directory that is in your path:
mv composer.phar /usr/local/bin/composer
Note: If the above fails due to permissions, you may need to run it again with sudo.
Note: On some versions of OSX the /usr directory does not exist by default. If you receive the error "/usr/local/bin/composer: No such file or directory" then you must create the directory manually before proceeding: mkdir -p /usr/local/bin.
Note: For information on changing your PATH, please read the Wikipedia article and/or use Google.
Now just run composer in order to run Composer instead of php composer.phar.

How to install Requests for PHP in Ubuntu?

How to install Requests for PHP (http://requests.ryanmccue.info/) on Ubuntu 14.04?
I have downloaded package with command:
$ wget https://github.com/rmccue/Requests/tarball/master -O - | tar xzv
In Phyton next step would be:
$ sudo python setup.py install
What command would I use for PHP?
If you install via composer, which I recommend you do, you can then include it just by including the 'autoload.php' that composer generates for you. Usually from your project root
require 'vendor/autoload.php'
but that will depend on the structure of your project. Then you're freely able to use
Requests::get($args); // or, of course, any of the other functions
from within your project.
Unless it's a compiled PHP extension, there is no installation step for PHP libraries. You download the files, you put them in a folder, you require the file you just downloaded. Typically you make those dependencies part of your PHP project instead of installing them "globally". Composer was created to simplify that process and help you manage dependencies. If you don't use it, it's up to you where to put those files and where to require them from.

Is composer available as a set of PHP scripts?

I haven't found any way of installing composer on my shared hosting. I don't understand the insistence of using a phar, surely composer could comfortably be ported to plain PHP scripts? Is there such a port? Or a way of achieving the same?
A phar file is a PHP archive. So download the composer file locally and upload them to your server. You need only a PHP-Interpreter installed on your CLI.
Then you can run them php composer.phar or without PHP if your host is correctly configured.
http://php.net/manual/de/phar.using.intro.php
https://getcomposer.org/download/
Normally you can install composer with the given command on the composer site.
php -r "readfile('https://getcomposer.org/installer');" | php

Composer install cant find composer.json

I am trying to just install composer, I am on mac osx. I have done it before using the terminal lines from their site and it worked just fine. I got a clean install on my mac now, and it won't install properly.
I tried to:
cd ~
curl -sS https://getcomposer.org/installer | php
and and:
cd /Applciations/MAMP/htdocs
curl -sS https://getcomposer.org/installer | php
and neither works. (I saw a post saying I should cd to a directory before trying to install it. But no matter what, I keep hitting this error:
Composer could not find a composer.json file in /Applications/MAMP/htdocs
To initialize a project, please create a composer.json file as described in the http://getcomposer.org/ "Getting Started" section
when trying to install composer.
I think your question arises from a slight misunderstanding. Composer installs itself when you run the script provided on their Web site. No additional work to install Composer is necessary.
$ php composer.phar install is used to install packages with Composer, which are almost always listed in a JSON file named composer.json. Without this file, Composer doesn't know which packages to install and fails.
See "Declaring Dependencies" in Composer's Getting Started guide for how to generate a composer.json for your project.
In my case, I had a deprecated error being output from PHP. Apparently that causes composer to fail detecting the composer.json file.

Is it possible to package and distribute Laravel based project with all of its dependencies included?

My client cannot install anything besides what is available via Debian packages, and so installing Composer is not an option (unless a Laravel / Composer package exists).
The best solution would be if the client could just unzip the project along with all of its (Laravel, Composer) dependencies and it would just work.
Is something like this possible to achieve? How?
The best solution would be if the client could just unzip the project
along with all of its (Laravel, Composer) dependencies and it would
just work.
Yes - this will work
Is something like this possible to achieve? How?
Like you said - if you have the project running on your directory - just zip it up (including the /vendors folder) - and they can unzip it. There is no need to "install" Laravel.
Once unzipped - the client should still be able to run php artisan migrate to do the database table migrations
Edit: actually - why cant they just run
php -r "readfile('https://getcomposer.org/installer');" | php
or
curl -sS https://getcomposer.org/installer | php
Its not a package - but its installed via PHP? See composer install docs for more info.

Categories