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
PHPのスカラー型をクラスでラップして便利に使えるようにするライブラリ「Stannum」を作った話
Search
tumugin.myskng
April 11, 2022
1.6k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
PHPのスカラー型をクラスでラップして便利に使えるようにするライブラリ「Stannum」を作った話
tumugin.myskng
April 11, 2022
Featured
See All Featured
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
11
940
Measuring & Analyzing Core Web Vitals
bluesmoon
9
860
Skip the Path - Find Your Career Trail
mkilby
1
140
Paper Plane
katiecoart
PRO
1
51k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
4k
A designer walks into a library…
pauljervisheath
211
24k
Being A Developer After 40
akosma
91
590k
Data-driven link building: lessons from a $708K investment (BrightonSEO talk)
szymonslowik
1
1.1k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
The Curse of the Amulet
leimatthew05
1
13k
DBのスキルで生き残る技術 - AI時代におけるテーブル設計の勘所
soudai
PRO
65
55k
Why Our Code Smells
bkeepers
PRO
340
58k
Transcript
Copyright© M&A PHP Stannum PHPerKaigi 2 0 2 2
Copyright© M&A 2 M&A Twitter: @myskng (Twitter ... ...) GitHub:
@tumugin PHP(Laravel) JavaScript TypeScript(Vue) ( Ruby Kotlin ...)
Copyright© M&A 3
Copyright© M&A 4
Copyright© M&A 5 ) , , , , , ,,
,,, ... string string
Copyright© M&A 6 ( ...) ( UI )
Copyright© M&A Ruby 7 ....? ' , , , ,
, ,, ,,,' .split(',') .filter { |s| !s.strip.empty? } .map { |s| s.strip } .uniq => [" ", " ", " ", " "] PHP ....( )
Copyright© M&A PHP 8 PHP ... $inputTags = ' ,
, , , , ,, ,,,'; $splitTags = explode(',', $inputTags); $splitTagsWithoutEmpty = []; foreach ($splitTags as $tag) { if (trim($tag) !== '') { $splitTagsWithoutEmpty[] = trim($tag); } } $splitTagsWithoutEmptyAndDuplicate = array_unique($splitTagsWithoutEmpty); ...? ....?
Copyright© M&A PHP 9 array_unique( array_map( fn(string $s) => trim($s),
array_filter( explode(',', ' , , , , , ,,, ,,'), fn(string $s) => trim($s) !== '' ) ) ); ...😇 😇 😇
Copyright© M&A 10 🥺🥺🥺
Copyright© M&A 11
Copyright© M&A 12
Copyright© M&A 13
Copyright© M&A 14 extension (nikic/scalar_objects) - ... - PHP
Copyright© M&A 15 RFCs PHP RFC: Autoboxing https://wiki.php.net/rfc/autoboxing PHP RFC:
Class-like Primitive Types https://wiki.php.net/rfc/class-like_primitive_types ...
Copyright© M&A 16 ...🥺🥺
Copyright© M&A 17 ...
Copyright© M&A 18 💡💡💡💡
Copyright© M&A 19
Copyright© M&A 20 ... tumugin/stannum PHP 7 . 4 (
array) float/double integer string Sn => Stannum( )
Copyright© M&A 21 SnString::byString(' , , , , , ,,
,,,') ->split(',') ->filter(fn(SnString $s) => !$s->trim()->isEmpty()) ->map(fn(SnString $s) => $s->trim()) ->distinct() ->toSnStringList() ->toStringArray(); ... PHP
Copyright© M&A 22 PHP ...?
Copyright© M&A ... foreach ...? 23 $sushiList = SnStringList::byStringArray([ '
', ' ', ' ', ' ', ' ', ]); foreach ($sushiList as $sushi) { // something... }
Copyright© M&A __toString() ...? 24 $wantToEatSushi = SnString::byString( ' '
); return "{$wantToEatSushi} "; =>
Copyright© M&A 25
Copyright© M&A 26 composer require tumugin/stannum