Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
PHPで tarballを実装してみる
Search
higaki
August 22, 2026
33
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PHPで tarballを実装してみる
https://phpstudy.connpass.com/event/401438/
https://github.com/higaki-takanori/php-tar
higaki
August 22, 2026
More Decks by higaki
See All by higaki
PHPで TLSのプロトコルを実装してみるをもう一度しゃべりたい
higaki_program
0
400
PHPで TLSのプロトコルを実装してみる
higaki_program
0
910
PHPでResult型を なるべく使いやすい形で実装する
higaki_program
2
440
PHPでResult型やってみよう
higaki_program
1
780
aspidaで型安全にREST APIのバックエンドを呼び出したい
higaki_program
0
820
Featured
See All Featured
Build your cross-platform service in a week with App Engine
jlugia
234
19k
Speed Design
sergeychernyshev
33
2.1k
Gemini Prompt Engineering: Practical Techniques for Tangible AI Outcomes
mfonobong
2
550
30 Presentation Tips
portentint
PRO
1
410
Raft: Consensus for Rubyists
vanstee
142
7.7k
技術選定の審美眼(2025年版) / Understanding the Spiral of Technologies 2025 edition
twada
PRO
120
120k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
YesSQL, Process and Tooling at Scale
rocio
174
15k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
340
Everyday Curiosity
cassininazir
0
330
[Rails World 2026] Durable orchestration on Rails: from continuation to workflow
palkan
1
310
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
530
Transcript
PHPで tarballを実装してみる 第190回 PHP勉強会@東京 ひがき いいことあるかも〜
なぜ? https://zenn.dev/levtech/articles/docker-build
なぜ?
なぜ? 急にアーカイブファイルって使ったけどなんも知らんかも、、、 ずっと胸にあった「もやもや 」を解消するため あと ファイルを複数まとめるって何??よくわからんですな👣
話すこと ①tarballについて ②PHP実装 ③何が嬉しいの?
tarballとは Tarball may refer to: Tarball (computing), a tar archive
file 引用:Wikipedia[https://en.wikipedia.org/wiki/Tarball] tar(ター、tape archives)はファイルアーカイブのファイルフォーマットの一種である。 このファイルフォーマットを処理する同名の UNIXコマンドtarも指す。 UNIXでは圧縮した tar形式のファイルを "tarball"(ターボール)と呼ぶこともある。 引用:Wikipedia[https://ja.wikipedia.org/wiki/Tar]
アーカイブファイルとは アーカイブ(英: archive)とはコンピュータにおいてデータ群を纏めて一体で保 存することを指す[1][2]。データと、ファイル作成日時や作成者などの付随するメ タデータを関連づけ長期間保存する目的で用いられる。 引用 :Wikipedia[https://ja.wikipedia.org/wiki/%E3%82%A2%E3%83%BC%E3%82%AB%E3%82%A4%E3%83%96_(% E3%82%B3%E3%83%B3%E3%83%94%E3%83%A5%E3%83%BC%E3%82%BF)]
つまり、tarballって 複数ファイルをいい感じにまとめて保存されたものってことね まとめる形式は色々あるけど、その一種ってことか〜 圧縮後もtarballって言ったりするのね〜 $ tar xvf sample.tar // tarball
→ 複数ファイル 展開 $ tar cvf sample.tar files // 複数ファイル → tarball 作成
こんな認識になった なんか、いい感じに複数ファイルをまとめてくれている 圧縮するときに使ったりしてるっぽいな こんな感じー?? 複数のファイル → ファイルアーカイブ → 圧縮後ファイル
こんな認識になった なんか、いい感じに複数ファイルをまとめてくれている 圧縮するときに使ったりしてるっぽいな こんな感じー?? 複数のファイル → ファイルアーカイブ → 圧縮後ファイル ☝本発表のスコープ
☝スコープ外
tarって100色あんねん
引用:techplus [https://ja.wikipedia.org/wiki/Tar]
tarballの種類 • • • • • • • • v7(Old-Style
Archive Format) Pre-POSIX Archives POSIX ustar Archives Pax Interchange Format GNU Tar Archives GNU tar pax archives Mac OS X Tar …
ヘッダーの作り方など 様々ある 引用:techplus [https://ja.wikipedia.org/wiki/Tar]
アーカイブする 「ヘッダー・ブロック」の作り 方など様々ある 引用:techplus [https://ja.wikipedia.org/wiki/Tar]
どのtarball作ったの? 基本はv7をベースにしつつ、tar コマンドで動くもの 完璧じゃなくてまずは動くものを実装した アーカイブファイル → 複数ファイル に展開するのは作っていない
ソースコード見ていきますか〜 の前に
工夫点 • 空白・ゼロ埋めが多いので、共通機構を作った • 各プロパティごとにクラスを実装した • タプルがいい感じに使えないのでクラスでいい感じにした Link の部分
個人的にふむふむと思った部分 • チェックサムの部分の計算が大変だった ヘッダーの中にチェックサムがあり、ゴニョゴニョ計算して導く • 10進数 → 8進数に変換してtarにしているのがいまだに疑問 mode(ファイルの所有権、755とかのやつ)が8進数になるからそれに 合わせているのかなー
ではでは ソースコード見ていきますか〜
引用:techplus [https://ja.wikipedia.org/wiki/Tar]
引用:techplus [https://ja.wikipedia.org/wiki/Tar]
引用:techplus [https://ja.wikipedia.org/wiki/Tar]
引用:techplus [https://ja.wikipedia.org/wiki/Tar]
引用:techplus [https://ja.wikipedia.org/wiki/Tar]
引用:techplus [https://ja.wikipedia.org/wiki/Tar]
引用:techplus [https://ja.wikipedia.org/wiki/Tar]
引用:techplus [https://ja.wikipedia.org/wiki/Tar]
引用:techplus [https://ja.wikipedia.org/wiki/Tar]
引用:Docker-docs-ja [https://docs.docker.jp/engine/reference/commandline/save.html]
自己紹介
自己紹介 ひがき 株式会社リンケージ 🍊PHPConference愛媛2026 実行委員長🐘 PHPConference愛媛2026開催!! • 2026年10月3日 • 愛媛大学
城北キャンパス
ご静聴ありがとうございました
Appendinx
https://github.com/higaki-takanori/php-tar