danieledangeli / betfair-php

Betfair php library
http://danieledangeli.github.io/betfair-php
47 stars 30 forks source link

Issue after install composer #4

Closed apuestaya closed 9 years ago

apuestaya commented 9 years ago

Hello, i downloaded source code keeping compose.json details and then i installed composer in xampp server, it created vendor and other folders with files. I checked in browser and there are two issues.

Deprecated: The ability to pass file names to the Symfony\Component\Yaml\Yaml::parse method is deprecated since version 2.2 and will be removed in 3.0. Pass the YAML contents of the file instead. in C:\xampp\htdocs\betfair\vendor\symfony\yaml\Symfony\Component\Yaml\Yaml.php on line 58

Fatal error: Unsupported operand types in C:\xampp\htdocs\betfair\vendor\guzzlehttp\guzzle-services\src\GuzzleClient.php on line 72

I fixed first one installing "symfony/yaml": "2.6.5" but the second one i could not figure out.

Thank you for your help.

danieledangeli commented 9 years ago

Hi, thanks for contributing. Ok, I have to investigate about the first issue. The second one is a problem that I also faced in my local environment and it's related to guzzle. I not sure if is a real error: in that line guzzle will use the operator "+" between arrays. I'm not sure why this error happens, which version of php do you have installed in your xampp server?

apuestaya commented 9 years ago

Hello, thank you for share this project. i have PHP Version 5.5.19, Yes, operator (=+) is causing the issue in guzzle. i tried with operator .= and then i got error converting array element to string. i also printed that line to see what it is its value but i got an empty result.

apuestaya commented 9 years ago

Other action tried was adding this line require "erlang/betfair": "0.2.0" in composer json before install composer through xampp shell (i removed all original requires), It should install with dependencies defined in your project located in packagist.org. But i got an error something like it can't find "erlangb/betfair" 1.0.0 but really you have not this version, Your lastest version is erlangb/betfair 0.2.0

danieledangeli commented 9 years ago

I think that to solve that you have to use array_merge. By the way, it's not a good practice to change the vendor libraries. This weekend I will have a look on how face this problem (if I'm able to replicate it). It's weird, the second error seems that you're looking for the version 1.0.0 that it's not present. Try to force composer to download a specified version: php composer.phar require erlangb/betfair-php:0.2.0. By the way, actually dev-master is at the same point of 0.2.0 so I'm not sure this solves the problem. I'm sorry about that, for what I know other people have used that version without problems.

apuestaya commented 9 years ago

Hellos. So, how should i have composer.json for production and not dev? This is my composer.json

{ "minimum-stability": "dev",

"name"       : "erlangb/betfair",
"type"       : "library",
"description": "Betfair API PHP 5.4+ library",
"keywords"   : ["Betfair", "API", "betting api", "betting", "bet"],
"homepage"   : "http://www.danieledangeli.com",
"license"    : "MIT",

"authors": [
    {
        "name"    : "Daniele D'Angeli",
        "email"   : "dangeli88.daniele@gmail.com",
        "homepage": "http://www.danieledangeli.com",
        "role"    : "Engineer"
    }
],

"require-dev": {
    "phpspec/phpspec": "2.1.1",
    "fabpot/php-cs-fixer": "@stable"
},
"config": {
    "bin-dir": "bin"
},

"require": {
    "php": ">=5.4.0",
    "guzzlehttp/guzzle": "5.2.0",
    "guzzlehttp/command": "0.8.0",
    "guzzlehttp/guzzle-services": "0.5.0",
    "symfony/yaml": "2.6.5"
},

"autoload": {
    "psr-0": { "Betfair": "src/" }
}

}

danieledangeli commented 9 years ago

I'm not following, this is my composer.json. Yours should have something like as follows: { "name": "your name", "description": "Your app desc", "require": { "php": ">=5.4", "erlangb/betfair": "0.2.*" }, "autoload": { "psr-4" : { "Your\Namespace\" : "src" } } }

danieledangeli commented 9 years ago

I think that this PR fixes it: https://github.com/danieledangeli/betfair-php/pull/8