walle89 / SwedbankJson

Unofficial API client for the Swedbank's and Sparbankerna's mobile apps in Sweden.
MIT License
75 stars 14 forks source link

Composer installation? #7

Closed Mrbrand closed 10 years ago

Mrbrand commented 10 years ago

I don't understand this new composer thing. Doesn't seem to be a php library as i first thought. How do I install it on my webserver? Sorry for being noobish.

walle89 commented 10 years ago

Have you read README.md? What part is unclear?

Edit 2016-10-25: You can read about Composer in docs/composer.md. It contains updated information about Composer and installation instructions.

Mrbrand commented 10 years ago

I guess this is the wrong forum but i don't get the installation part. Usually i download a zip file and put the content in a folder with ftp. Now i install this via a terminal window? Where do i find that? Would that be on my apache web host?

14 maj 2014 kl. 17:26 skrev Eric Wallmander notifications@github.com:

Have you read README.md? What part is unclear?

— Reply to this email directly or view it on GitHub.

walle89 commented 10 years ago

I think this can awnser your questions: https://getcomposer.org/doc/00-intro.md

After you have read that, follow the installation guide.

How you get to it depends on what OS you are running. OSX you can find terminal by use spotlight and search "Terminal".

On Windows, you can follow this guide: http://www.naeemrana.com/technology/how-to-install-composer-dependency-manager-for-php-in-windows/

If you have reached to this ponit, all you have to do is navigate in terminal/cmd.exe to the folder you wish to install SwedbankJson (usual in the root folder for your project) and then run "php composer.phar require walle89/swedbank-json ~0.3"

walle89 commented 10 years ago

How is it going @Mrbrand? Have you done a successful installation with Composer? Do you any help?

Mrbrand commented 10 years ago

No, not yet. Am I correct to assume that i need to download composer, install it on my windows computer, compose a library that contains guzzle and then upload it to my webserver?

16 maj 2014 kl. 14:33 skrev Eric Wallmander notifications@github.com:

How is it going @Mrbrand? Have you done a successful installation with Composer? Do you any help?

— Reply to this email directly or view it on GitHub.

walle89 commented 10 years ago

Edit 2016-10-25: You can read about Composer in docs/composer.md. It contains updated information about Composer and installation instructions.

Well, you are almost right. When I installed and tested this project on Windows, this is how I did it:

Install Composer

  1. Make sure you have PHP installed on your computer. The way I did it was to install wampserver (http://www.wampserver.com/en/). A nice bonus with wampserver is you can run PHP scirpts localy before you upload it to a server.
  2. Run Compoer-Setup.exe.
  3. Follow the instructions. Make sure you install "Shell menus" and add the path to php.exe. Mine is C:\xampp\php\php.exe.

Compose SwedbankJson

  1. Go to the project folder or create new folder where ever you want. Example: C:\SwedbankJson.
  2. Right click and chose "Use Composer here", a cmd.exe window shall pop up.
  3. Now run this command: composer require walle89/swedbank-json
  4. Now you have a vendor folder and ready to be integrated into your awesome application. A good start is to create a php-file with the code you can find in docs/introduktion.md. To run the script, either run it from wampserver or upload it to FTP.

Feature updates

  1. Navigate to the project folder on you local machine (C:\SwedbankJson in my case)
  2. Right click and choose "Composer Options" -> "Self-update".
  3. Right click and choose "Composter update".
  4. Done! Run locally or upload everything to FTP.

I hope this helps.

Mrbrand commented 10 years ago

Thanks a lot! This will definitly be helpful.

Allthough one thing i dont understand is why this needs to be done by everyone personally. Why not create a general /vendor/autoload.php and add it to your github project?

17 maj 2014 kl. 01:28 skrev Eric Wallmander notifications@github.com:

Well, you are almost right. When I installed and tested this project on Windows, this is how I did it:

Installation of Composer

Make sure you have PHP installed on your computer. The way I did it was to install wampserver (http://www.wampserver.com/en/). A nice bonus with wampserver is you can run PHP scirpts localy before you upload it to a server. Run Compoer-Setup.exe. Follow the instructions. Make sure you install "Shell menus" and add the path to php.exe. Mine is C:\xampp\php\php.exe. Compose SwedbankJson

Go to the project folder or create new folder where ever you want. Example: C:\SwedbankJson. Right click and chose "Use Composer here", a cmd.exe window shall pop up. Now run this command: composer require walle89/swedbank-json ~0.3 Now you have a vendor folder and ready to be integrated into your awesome application. A good start is to create a php-file with the code you can find in README.md. To run the script, either run it from wampserver or upload it to FTP. Feature updates

Navigate to the project folder on you local machine (C:\SwedbankJson in my case) Right click and choose "Composer Options" -> "Self-update". Right click and choose "Composter update". Done! Run locally or upload everything to FTP. I hope this helps.

— Reply to this email directly or view it on GitHub.

walle89 commented 10 years ago

Edit 2016-10-25: You can read about Composer in docs/composer.md. It contains updated information about Composer and installation instructions.

Short answer Every composer project is unique and depends on how your environment looks like, you have to install my library differently. Composer takes care of this and you don't have to think about it.

Long answer Every Composer project shares a vendor folder. If you have already using another composer project, it's a risk you overwrite there files. But even if you avoid this problem there are many other problems like if two libraries share same dependencies (eg. Guzzle) but different versions, you will not able use that library without altering the code. And next time you need to update my library (eg. Swedbank has altered there API), then you probably need to alter the code again. There is even a clear recommendation in the Compser manual to exclude vendor folder in .gitignore.

Not only Compoer solves this problems, you will get benefits like if two libraries have one or two common dependencies (eg. exact same version of Guzzle). Without Composer, you probably needs to download two copies of Guzzle with the exact same code. That's just waste of diskspace. Composer solves this problem. One other thing is if you using a framework with composer like Laravel, libraries like mine will "automatically" be compatible.

walle89 commented 10 years ago

I assume this issue as solved.