How to install PHRETS 2.0? - php

What are all the step by step process to install phrets in ubuntu?
I tried the following, but then unable to run phrets
First I got installed composer.
Then I ran composer require troydavisson/phrets
Now I have two files composer.json and composer.lock, and a folder named "vendor"
Inside vendor folder, I can see autoload.php file and some other folders
Now I tried the sample code from phrets git
But then am getting the following error,
PHP Fatal error: Class 'Monolog\Logger' not found in /var/www/testing/newphrets.php on line 7
Please advice what am missing here. Am planning to switch my project from old version to phrets 2.0.
Thanks

According to Troy's PHRETS 2.0 Logging video on YouTube and looking at PHRETS' composer.json, you can see that you need to do one of two things. Either,
(a) Add monolog to your project's composer.json,
{
"require": {
"troydavisson/phrets": "2.*",
"monolog/monolog": ">=1.10"
}
}
and run composer update in your project's root directory.
or,
(b) Since monolog is in PHRETS' composer.json file but in the require-dev section, run composer install --dev or composer update --dev to indicate you're currently in development and would like to use the development libraries.

Related

installing php app via composer

I wanted to install via composer given information like this
{
"name": "bitcoin app",
"require": {
"slim/slim": "2.2.0"
}
}
I am unable to recognize do I have to write this to a php file and upload to the server?
Composer is a PHP based dependency management system.
That's a snippet of a composer.json file used to get & manage initial dependencies, to use it you'll need to have PHP & Composer installed and then create a file called composer.json in the location you'd like to have the project created.
Once you'd done that run composer install to get the dependencies. This won't actually install an app persay, you'll still need to make that yourself.
Scotch.io has a decent beginners guide to Composer if you're uncertain about how to install it & what it's actually used for.
No. You should write this to a json file named composer.json.
Then use composer to install the package: composer install
1) First you need to create or found composer.json
2) Then write your code in this file
3) In last you have to update composer.

Installing Yii2: Invalid Parameter – yii\base\InvalidParamException

I'm installing Yii2 in the way that shows the Getting Started tutorial:
composer global require "fxp/composer-asset-plugin:~1.1.1"
composer create-project --prefer-dist yiisoft/yii2-app-basic basic
When I try to access localhost/YiiTutorial/basic/web I get this error:
Invalid Parameter – yii\base\InvalidParamException
The file or directory to be published does not exist: C:\wamp\www\YiiTutorial\basic\vendor\bower/jquery/dist
In the tutorial says that is nothing to edit... it should work right out of the box... what I'm missing?
If I download the package and place it in the same folder, it works perfect, but I want to install it from composer!
Inside vendor/bower folder it's another one called bower-asset.
Copy this folder content (some other folders named bootstrap, jquery, etc...) and move them to vender/bower.
it a recent bug. update your fxp plugin to latest version (1.1.1) and clear composer's cache and try :
composer self-update
composer global update
composer update
Mainly if not issue regarding to vendor installation so please give permission to your /assets and /runtime folers of your projects and try to run again.
In your vendor folder you should rename bower-asset to bower .
OR you can use the following
make sure that you have the following in your composer.json:
composer.json
Other ways
I have encountered this kind of problem lately, the issue is in your composer it missing the asset-plugins which allows managing bower and npm package dependencies through Composer. Just run this command, you only need to run this command once for all. You can read the yii2 docs. Yii2 Installation
composer global require "fxp/composer-asset-plugin:^1.2.0"

Why do CodeIgniter projects sometimes include composer.phar package?

I'm new to Composer and in my current project I would like to install a bunch of PHP libraries like:
Doctrine
Security Library (Which i have no idea but looking for in CodeIgniter)
Bootstrap layout libraries and other when necessary
For that matter , I would like to use Composer based library management in my application,
and i get confused that if i have to include composer.phar on my project directory or not.
since i have it on my environment path and I can run Composer form command line .
How can integrate the above libraries into my codeigniter application then..
Appreciate your toughs!
The composer.phar file is an executable and it should not be committed. What it actually does is that it looks in your composer.json file and there you can declare some more dependencies (libraries for example) and their version:
{
"require": {
"doctrine/orm": "*"
}
}
The version in this case is declared with "*" so Composer will get the latest version. This is very useful if there are more people on the project, to make sure all of them have the same version of dependencies installed (so the composer.json file must be committed).
If you run "composer.phar update" on the other hand, this will get the latest version of all dependencies, no matter the version placed in composer.json and updates the lock file with the new versions.

PHP failed to load vendor folder : How to install composer on my server?

Asked Here but no proper response.
Hi, When I tried to use paypal sdk, and when I tried to submit the details, it is showing this error.
Fatal error: require(): Failed opening required '/home/wwwrapid/public_html/test/samples/vendor/paypal/paypal-merchant-sdk-php-4f570f5/lib/services/PayPalAPIInterfaceService/PayPalAPIInterfaceService.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/wwwrapid/public_html/test/merchant-sdk-php-master/samples/PPAutoloader.php on line 451
When I go through the folders path, I dont find any folder named 'vendor'.
I have been searching the solution for this for two days. Some sites say it's a composer error and installing composer solves the issue. and this is the code for that.
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
My problem is I am not able to understand what they mean? I don't even know where to add this code? I mean in which file? How can that composer be installed on my site?
If you're on Windows the easiest thing to do is download the Windows installer and use it.
In order for Composer to install, though, you're going to need PHP installed. The easiest way to do this is to just configure a local server setup using WAMP or something similar. You'll need do that prior to installing Composer.
Once all of that is done you'll be able to utilize Composer to manage PHP packages within your projects. It's really pretty awesome stuff, but it can be a little confusing if you've never worked with it before.
Basically, once it's installed, you can just create a composer.json file at your project root. This file is basically a config file that tells Composer what PHP packages you want to use (among other things.)
For PayPal's SDK you could setup a composer.json file with nothing but this in it:
"require": {
"php": ">=5.3.0",
"ext-curl": "*",
"ext-json": "*",
"paypal/rest-api-sdk-php" : "0.5.*"
}
Then, from the command line, you can browse to the project root (where the composer.json file is) and run "composer update".
This would look at the composer.json file and download any/all packages that are required based on that line. In this case it would be pulling in the PayPal REST API SDK, and then all of the samples that PayPal provides would work for you.
Composer is what creates that /vendor directory and sets up an autoloader for you. Hope that helps.

Install dependency (doctrine/dbal) on composer laravel

I am trying to execute a migration to rename some columns and I got an exception.
As I read on the documentation I have to add the doctrine/dbal dependency to my composer.json file. How do I do that? Which is the correct composer.json file. I have many in my application. Is the one that is on the same level as the folders app,bootstrap, public and vendor.
If so how do I add that dependency. Do I have to download anything?
By the way im using easyphp, not wamp!
Edit 1
After doing that the console throws this error
1) To install dependency , run this command
composer require doctrine/dbal
2) For 'git' is not recognized error, either you don't have git installed or the PATH is not added in the environment variables.
Install git for windows.
To add this dependency open the composer.json at the root of your project (in the same level as app, public etc.) and in the require section add the doctrine/dbal package like:
"require": {
"laravel/framework": "4.1.*",
"doctrine/dbal": "v2.4.2"
},
Save the file and run composer update
Edit
You probably installed git with the default settings and it's not in your PATH env.
Open Git Bash (it was installed with git - you will find it in your programs) and do composer update. By the way it's far better that windows command prompt.
If you are getting error while running migration try this
composer require doctrine/dbal:2.*

Categories