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
4 Signs Your Business is Dying
shpigford
187
22k
Ethics towards AI in product and experience design
skipperchong
2
330
Unsuck your backbone
ammeep
672
58k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
2k
Optimising Largest Contentful Paint
csswizardry
37
3.8k
Embracing the Ebb and Flow
colly
88
5.1k
How GitHub (no longer) Works
holman
316
150k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.1k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3.4k
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
490
First, design no harm
axbom
PRO
2
1.2k
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