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.7k
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
Marketing Yourself as an Engineer | Alaka | Gurzu
gurzu
0
280
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
201
75k
Into the Great Unknown - MozCon
thekraken
41
2.7k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
440
It's Worth the Effort
3n
188
29k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.5k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
250
The browser strikes back
jonoalderson
0
1.5k
Building a Modern Day E-commerce SEO Strategy
aleyda
45
9.2k
We Have a Design System, Now What?
morganepeng
55
8.3k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
2
3.8k
Paper Plane (Part 1)
katiecoart
PRO
1
10k
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