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
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
850
Other Decks in Programming
See All in Programming
The Bowling Game- From Imperative to Functional Programming - Part 1
philipschwarz
PRO
0
310
AI駆動開発を妨げる技術的負債の解消アプローチ / ai-refactoring-approach
minodriven
17
8.9k
コーディングルールの鮮度を保ちたい for SRE NEXT 2026 / keep-fresh-go-internal-conventions-sre-next-2026
handlename
0
140
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
150
20260623_Loop Engineeringで自分の分身の問い合わせBotを作る
ryugen04
0
200
そのテスト、説明できますか?~LWテスト戦略FW~のご紹介
nakahara
0
200
【やさしく解説 設計編・中級 #4】ルールの寿命と、システムの年輪
panda728
PRO
2
120
コンテキストの使い捨てをやめる — ビジネスルール駆動開発と miko —
ioki
0
270
トークンをケチるな、設計しろ:GitHub Copilotを賢く使うコンテキスト戦略
ochtum
0
310
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
160
Performance Engineering for Everyone
elenatanasoiu
0
270
ローカルLLMでどこまでコードが書けるか -縮小版 / How much code can be written on a local LLM Shortened
kishida
2
190
Featured
See All Featured
Navigating Weather and Climate Data
rabernat
0
320
Have SEOs Ruined the Internet? - User Awareness of SEO in 2025
akashhashmi
0
390
Fireside Chat
paigeccino
42
4k
Are puppies a ranking factor?
jonoalderson
1
3.7k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
2
230
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
260
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
28
3.6k
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
1
220
The Invisible Side of Design
smashingmag
301
52k
GraphQLとの向き合い方2022年版
quramy
50
15k
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