Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
社内パッケージの再利用にSatisを使っている話.pdf
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
kin29
April 11, 2022
Programming
1.3k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
社内パッケージの再利用にSatisを使っている話.pdf
PHPerKaigi2022
kin29
April 11, 2022
More Decks by kin29
See All by kin29
外部APIとズブズブな開発どうしてますか?
kin29
2
2.2k
【Symfony超入門】コマンドだけでCRUD画面を作るチート法
kin29
0
890
めんそ〜れ!モブプロ!!!
kin29
0
840
Other Decks in Programming
See All in Programming
dRuby over BLE
makicamel
2
380
技術記事、 専門家としてのプログラマ、 言語化
mizchi
13
6.2k
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
360
The NotImplementedError Problem in Ruby
koic
1
840
Oxcを導入して開発体験が向上した話
yug1224
4
320
Hunting Vulnerabilities in Symfony with LLMs
vinceamstoutz
0
550
Snowflake Summitでの新機能 CoCo / CoWork / snowflake-summit-2026-overall-what-new-coco
tatsuhiro
1
150
Go1.27で導入されるジェネリクスメソッドでできること
mackee
0
140
Claspは野良GASの夢をみるか
takter00
0
200
並列実装の現場、2ヶ月間実務でAIを使い倒したAIもPCも私も限界が近い
ming_ayami
0
130
The ROI of Quarkus for Spring Boot Applications
hollycummins
0
120
RTSPクライアントを自作してみた話
simotin13
0
610
Featured
See All Featured
Tell your own story through comics
letsgokoyo
1
960
AI: The stuff that nobody shows you
jnunemaker
PRO
8
720
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Accessibility Awareness
sabderemane
1
140
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
620
First, design no harm
axbom
PRO
2
1.2k
Making the Leap to Tech Lead
cromwellryan
135
9.9k
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.7k
Technical Leadership for Architectural Decision Making
baasie
3
420
Discover your Explorer Soul
emna__ayadi
2
1.1k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
420
30 Presentation Tips
portentint
PRO
1
330
Transcript
社内パッケージの再利用に satisを使っている話 志賀 彩乃
自己紹介 • 林(旧:志賀) 彩乃 • PHPer 6年 • Symfony 3年
• カルテットコミュニケーションズ 3年(産休育休1年含む) • 子育て中(1歳半息子) Twitter: @kin29ma_n / GitHub: @kin29
本題に入ります
PHPerのみなさんに質問です プライベートな社内パッケージを再利用したい時、 どうやってますか?
プライベートな社内パッケージの例 プライベートな社内パッケージ (秘伝のタレ) サービスA (秘伝のタレを使ったうなぎ ) サービスB (秘伝のタレを使った焼き鳥 )
(packagistに未登録) quartetcom/repository composer requireできない packagistに登録していないリポジトリは再利用することはできない packagist symfony/symfony … $ composer
require symfony/symfony $ composer require quartetcom/repository
しかし
quartetcom/repository を使いたい人 composer requireできる + "repositories": { + "quartetcom/repository": {
+ "type": "vcs", + "url": "https://github.com/quartetcom/repository.git" + } + } composer.json composer.jsonのrepositoriesに追加すればcomposer requireできる! $ composer require quartetcom/repository quartetcom/repository (packagistに未登録)
ただし、以下のデメリットがある🥺 • 再利用したいリポジトリが複数ある場合、 そのリポジトリの数だけcomposer.jsonに追記する必要がある。
quartetcom/repo1~3 を使いたい人 "repositories": { "quartetcom/repo1": { "type": "vcs", "url": "https://github.com/quartetcom/repo1.git"
} } composer.json quartetcom/repo1 (packagistに未登録) $ composer require
quartetcom/repo1~3 を使いたい人 "repositories": { "quartetcom/repo1": { "type": "vcs", "url": "https://github.com/quartetcom/repo1.git"
}, + "quartetcom/repo2": { + "type": "vcs", + "url": "https://github.com/quartetcom/repo2.git" + }, } composer.json quartetcom/repo1 (packagistに未登録) quartetcom/repo2 $ composer require $ composer require
quartetcom/repo1~3 を使いたい人 "repositories": { "quartetcom/repo1": { "type": "vcs", "url": "https://github.com/quartetcom/repo1.git"
}, + "quartetcom/repo2": { + "type": "vcs", + "url": "https://github.com/quartetcom/repo2.git" + }, + "quartetcom/repo3": { + "type": "vcs", + "url": "https://github.com/quartetcom/repo3.git" + } } composer.json quartetcom/repo1 (packagistに未登録) quartetcom/repo2 quartetcom/repo3 $ composer require
quartetcom/repo1~3 を使いたい人 quartetcom/repo1 (packagistに未登録) quartetcom/repo2 quartetcom/repo3 $ composer require "repositories":
{ "quartetcom/repo1": { "type": "vcs", "url": "https://github.com/quartetcom/repo1.git" }, + "quartetcom/repo2": { + "type": "vcs", + "url": "https://github.com/quartetcom/repo2.git" + }, + "quartetcom/repo3": { + "type": "vcs", + "url": "https://github.com/quartetcom/repo3.git" + } } composer.json めんどう😓
その問題、Satisで解決できるかも
{ "name": "quartetcom.composer", "homepage": "https://quartetcom/composer", "repositories": [ { "type": "vcs",
"url": "https://github.com/quartetcom/repo1" }, { "type": "vcs", "url": "https://github.com/quartetcom/repo2" }, { "type": "vcs", "url": "https://github.com/quartetcom/repo3" } ], "require-all": true } satis.json quartetcom/repo1~3 を使いたい人 再利用したいリポジトリ quartetcom/repo1 quartetcom/repo2 quartetcom/repo3 $ composer require + "repositories": { + "quartetcom": { + "type": "composer", + "url": "https://quartetcom/composer" + } + }, composer.json $ vendor/bin/satis build satis.json web/ Scanning packages Wrote packages to docs/p2/quartetcom/repo1.json Wrote packages to docs/p2/quartetcom/repo1~dev.json … Writing packages.json Pruning include directories Writing web view
メリット💡 • satis.jsonに再利用対象のリポジトリを追加→buildするだけでok • 複数パッケージを一括管理しやすい • 一覧画面もいい感じにできる👉 • Basic認証で制限も可能 •
ビルドインwebサーバで無料で簡単にできる $ php -S localhost:8888 -t web • GitHub Pagesでも作れました🎉 https://kin29.github.io/composer-repository/
kin29/repo1 - v0.0.1 - v0.0.2🆕 POST (おまけ)GitHub Actionsでsatis buildを自動化してみた! on:
release: types: [published] jobs: run: | curl --request POST 'https://api.github.com/repos/kin29/coposer-repository/dispatches' \ --header 'Authorization: Bearer ${{secrets.MY_TOKEN}}' \ --header 'Content-Type: application/json' \ --data-raw '{"event_type": "repository-updated"}' kin29/composer-repository on: repository_dispatch: types: [repository-updated] jobs: - name: satis build run: | composer config --global github-oauth.github.com ${{secrets.MY_TOKEN}} vendor/bin/satis build satis.json docs - name: Push build files run: | git remote set-url origin https://github-actions:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPO} git config --global user.name "${GITHUB_ACTOR}" git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" if (git diff --shortstat | grep '[0-9]'); then \ git add .; \ git commit -m "👕 Fixed satis build files by github-actions"; \ git push origin HEAD:${GITHUB_REF}; \ fi
private packagistというサービスもあります • https://packagist.com/ • 無料トライアルあり(その後は課金制)
ところで
実はComposer、 Symfonyコミュニティから生まれました!
カルテットはSymfonyで開発をしています! エンジニア・デザイナー大募集中です。 私のようにフルリモートで働くことができたり、 子育て中でも働きやすい環境です^^ ご興味がある方はこちらからどうぞ👇 https://quartetcom.co.jp/recruit/engineer/
ご清聴ありがとうございました 参考: https://getcomposer.org/doc/articles/handling-private-packages.md https://github.com/composer/satis