omise / omise-php

Omise PHP library
https://docs.opn.ooo
MIT License
67 stars 41 forks source link

[PC] tried to install omise via composer but it shows errors #41

Closed khunemz closed 7 years ago

khunemz commented 8 years ago

Tried to install omise for php Command on PowerShell composer install

Errors log:

Loading composer repositories with package information 
Updating dependencies (including require-dev) 
  - Installing omise/omise-php (dev-master c7a49d4) 
    Downloading: 100% 
    Failed to download omise/omise-php from dist: There was an error extracting the ZIP file, it is either corrupted or using an invalid format. 
    Now trying to download from source 
  - Installing omise/omise-php (dev-master c7a49d4) 
    Cloning c7a49d442a7bbf20b280bd85e9dc1ba17ddc54c4 from cache 
    c7a49d442a7bbf20b280bd85e9dc1ba17ddc54c4 is gone (history was rewritten?) 

  [RuntimeException] 
  Failed to execute git checkout "c7a49d442a7bbf20b280bd85e9dc1ba17ddc54c4" -- && git reset --hard "c7a49d442a7bbf20b280bd85e9dc1ba17ddc54c4" -- 
  Note: checking out 'c7a49d442a7bbf20b280bd85e9dc1ba17ddc54c4'. 
  You are in 'detached HEAD' state. You can look around, make experimental 
  changes and commit them, and you can discard any commits you make in this 
  state without impacting any branches by performing another checkout. 
  If you want to create a new branch to retain commits you create, you may 
  do so (now or later) by using -b with the checkout command again. Example: 
    git checkout -b <new-branch-name> 
  HEAD is now at c7a49d4... Merge pull request #37 from omise/code-revise 
  error: unable to create file tests/fixtures/api.omise.co/customers/cust_test_5234fzk37pi2mz0cen3/cards/?limit=1-get.json: Invalid argument 
  fatal: Could not reset index file to revision 'c7a49d442a7bbf20b280bd85e9dc1ba17ddc54c4'.

composer.json

...
"require" : {
"omise/omise-php": "dev-master",
}, 
...

How could I fix it , how to prevent this in the future ?

guzzilar commented 8 years ago

Hi, @khunemz

Could you please try install with the following command and let me know the result?

composer install --no-dev

Thanks, Nam.

guzzilar commented 8 years ago

@khunemz Sorry that I didn't explain well in previous comment,

For the issue, I'm guessing that the cause may came from the name of the file ?limit=1-get.json that some OS doesn't allow to name the file with ? character.

Please let me know if you still stuck with the same error after run the above command.

Thank you, Nam.

khunemz commented 8 years ago

I have followed with your instruction but it still shows the same error above. Please consider my scenario ,

  1. cloned repository from Git provider
  2. removed composer.lockrm -rf composer.lock 2.5 cleared cache composer clear-cache
  3. reinstalled by usingcomposer update
  4. And Baaammmmmm got stuck with this weird error.
iicmaster commented 7 years ago

same as me

Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing omise/omise-php (dev-master c7a49d4)
    Downloading: 100%
    Failed to download omise/omise-php from dist: Could not delete /var/www/html/vendor/omise/omise-php/892e6aaa1a6152b59085e11250afcb33:
    Now trying to download from source
  - Installing omise/omise-php (dev-master c7a49d4)
    Cloning c7a49d442a7bbf20b280bd85e9dc1ba17ddc54c4
    c7a49d442a7bbf20b280bd85e9dc1ba17ddc54c4 is gone (history was rewritten?)

  [RuntimeException]
  Failed to execute git checkout 'c7a49d442a7bbf20b280bd85e9dc1ba17ddc54c4' -- && git reset --hard 'c7a49d442a7bbf20b280bd85e9dc1ba17ddc54c4' --
  Note: checking out 'c7a49d442a7bbf20b280bd85e9dc1ba17ddc54c4'.
  You are in 'detached HEAD' state. You can look around, make experimental
  changes and commit them, and you can discard any commits you make in this
  state without impacting any branches by performing another checkout.
  If you want to create a new branch to retain commits you create, you may
  do so (now or later) by using -b with the checkout command again. Example:
    git checkout -b new_branch_name
  HEAD is now at c7a49d4... Merge pull request #37 from omise/code-revise
  error: unable to create file tests/fixtures/api.omise.co/customers/cust_test_5234fzk37pi2mz0cen3/cards/?limit=1-get.json (Protocol error)
  fatal: Could not reset index file to revision 'c7a49d442a7bbf20b280bd85e9dc1ba17ddc54c4'.

but it works if use composer install --no-dev

chaiwatmat commented 7 years ago

Try this command composer require omise/omise-php dev-master

iicmaster commented 7 years ago

@chaiwatmat thanks for your suggestion but it still doesn't work. and after I found it doesn't compatible with Laravel I better write my own CURL request. no point to wasted more time to install this.

guzzilar commented 7 years ago

Hi, @iicmaster @khunemz

Thanks for reported back to us. I've created one issue ticket that related with this issue. Here https://github.com/omise/omise-php/issues/48

You could follow the progress from there.

Cheers! Nam

guzzilar commented 7 years ago

Hi again @iicmaster šŸ™‚

For Laravel issue, you could add Omise-PHP to composer.json and use by add \ in front of class name.

For example,

<?php
namespace Acme\Controllers;

class Something extends Controllers
{
    public function sweet()
    {
        $charge = \OmiseCharge::create();
    }
}

Anyway, I also have created the project tasks for implement namespace to Omise-PHP. Here https://github.com/omise/omise-php/projects/1

This one would give a fully support for PSR-4 standard, and also, Laravel.

Please feel free to throw any idea/suggestion that I could help you to improve for the next Omise-PHP version!

Cheers šŸ» Nam

thanapongp commented 7 years ago

Hi @guzzilar,

This is maybe a little off-topic, but do you have any contribution guideline? I want to help contribute to the new version of this library in anyway I can.

Thanks.

nimid commented 7 years ago

Hi @thanapongp,

Thank you very much that you are giving the effort for the contribution. This is very helpful and value for us.

In general, you can create the pull request to improve in any parts of the project or submit the issue that you found.

For the new version of this project, currently, it is on the process of code review. You can help to provide the comment, the better solution, testing on your convenient environment, the other parts that it should be covered or etc. These feedbacks are useful and they can be discussed.

thanapongp commented 7 years ago

Thanks for you answer @nimid, I will try and contribute to this project in anyway I can.

guzzilar commented 7 years ago

@khunemz @iicmaster Hi, sorry to not mention here, the solution was introduced at the release v2.7.0.

Now I'm going to close this ticket. Please feel free to submit another ticket in case if you find any issue further.

Cheers, Nam.