16
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

composer使う時にgithubのトークンを聞かれた

Posted at

PHPから何年も離れていてcomposerとか初めて使うぐらいです。

Laravel5.1体験ハンズオンセミナー!!に参加しつつ詰まったところメモなど。

composerコマンドの確認

composerはNode.jsでいうところのnpm的な存在って認識です。

$ which composer
/usr/local/bin/composer

ちゃんといるみたい。

$ composer
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.0-dev (15face5432d7b7334db6ac69fac0190971cafa6e) 2015-09-23 17:46:25

Usage:
 command [options] [arguments]

Options:
 --help (-h)           Display this help message
 --quiet (-q)          Do not output any message
 --verbose (-v|vv|vvv) Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
 --version (-V)        Display this application version
 --ansi                Force ANSI output
 --no-ansi             Disable ANSI output
 --no-interaction (-n) Do not ask any interactive question
 --profile             Display timing and memory usage information
 --working-dir (-d)    If specified, use the given directory as working directory.

Available commands:
 about            Short information about Composer
 archive          Create an archive of this composer package
 browse           Opens the package's repository URL or homepage in your browser.
 clear-cache      Clears composer's internal package cache.
 clearcache       Clears composer's internal package cache.
 config           Set config options
 create-project   Create new project from a package into given directory.
 depends          Shows which packages depend on the given package
 diagnose         Diagnoses the system to identify common errors.
 dump-autoload    Dumps the autoloader
 dumpautoload     Dumps the autoloader
 global           Allows running commands in the global composer dir ($COMPOSER_HOME).
 help             Displays help for a command
 home             Opens the package's repository URL or homepage in your browser.
 info             Show information about packages
 init             Creates a basic composer.json file in current directory.
 install          Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
 licenses         Show information about licenses of dependencies
 list             Lists commands
 remove           Removes a package from the require or require-dev
 require          Adds required packages to your composer.json and installs them
 run-script       Run the scripts defined in composer.json.
 search           Search for packages
 self-update      Updates composer.phar to the latest version.
 selfupdate       Updates composer.phar to the latest version.
 show             Show information about packages
 status           Show a list of locally modified packages
 suggests         Show package suggestions
 update           Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.
 validate         Validates a composer.json and composer.lock

まずはOKみたいです。

composerコマンドでプロジェクトを使う

$ composer create-project laravel-plus/laravel5-handson

これで依存関係解決しつつ利用するプロジェクトを落としてくるみたいです。

・
・
・
Token (hidden):

途中でtokenを聞かれます。

調べるとgithubのAPIトークンを取得する - Qiitaという記事がありました。

curl -u 'ユーザー名' -d '{"scopes":["repo"],"note":"Help example"}' https://api.github.com/authorizations

って感じでトークン取得できるみたいです。

別タブで作業を進めましょう。

私のgithubのユーザー名はn0bisukeなので以下のようなコマンドを実行します。

$ curl -u 'n0bisuke' -d '{"scopes":["repo"],"note":"Help example"}' https://api.github.com/authorizations

途中でgithubのパスワード入力を求められますので入力しましょう。

Enter host password for user 'n0bisuke': 自分のパスワード入力

{
  "id": 23072119,
  "url": "https://api.github.com/authorizations/23072119",
  "app": {
    "name": "Help example",
    "url": "https://developer.github.com/v3/oauth_authorizations/",
    "client_id": "00000000000000000000"
  },
  "token": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "hashed_token": "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy",
  "token_last_eight": "zzzzzzzz",
  "note": "Help example",
  "note_url": null,
  "created_at": "2015-10-10T04:45:32Z",
  "updated_at": "2015-10-10T04:45:32Z",
  "scopes": [
    "repo"
  ],
  "fingerprint": null
}

こんな感じでtokenのxxxxxxxxxxxxxxxxxxxxxの部分をコピーして、先ほどのcomposerコマンドでトークンを聞かれた部分で貼り付けましょう。すると続きでダウンロードが始まります。

・
・
・
(省略)
・
・
> php artisan vendor:publish
Publishing complete for tag []!
> php artisan database:upgrade
Up [framework/1.0] Run class App\Database\Migrations\Framework_1_0

laravel5-handsonというフォルダが出来ていると思います。

$ ls
laravel5-handson
$ cd laravel5-handson
$ ls
addons        composer.json package.json  readme.md     test
app           composer.lock phpspec.yml   resources     tests
artisan       config        phpunit.xml   server.php    vendor
bootstrap     gulpfile.js   public        storage

こんな感じでDL出来ていればOKです。

16
17
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
16
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?