Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PHPコードを消すライブラリを作った

kubotak
April 11, 2022

 PHPコードを消すライブラリを作った

PHPerKaigi 2022 @ 2022/04/11 14:20〜 Track A レギュラートーク(20分)

kubotak

April 11, 2022
Tweet

More Decks by kubotak

Other Decks in Programming

Transcript

  1. Copyright© M&A
    PHP
    PHPerKaigi
    2
    02
    2
    @ Kenjiro Kubota

    View full-size slide

  2. Copyright© M&A
    Profile
    kubotak-is
    kubotak_public
    kenjiro.kubota
    M&A
    (Java|Type)Script
    PHP
    https://kubotak.page
    Web Laravel ( )

    View full-size slide

  3. Copyright© M&A
    M&A
    3
    ങ͍ख
    ɾҊ݅ใु͸M&A੒ޭใुͷΈ
    ɾ࠷௿ख਺ྉͳ͠
    ɾചΓखιʔγϯάͷνϟωϧ͕૿͑Δ
    ɾM&AχʔζΛൃ৴͢Δ͚ͩͰചΓखΛू٬
    ɾ஥հۀऀΛհͣ͞ʹμΠϨΫτʹ΍ΓऔΓՄೳ
    ɾજࡏ૚ʹ΋Ϧʔν͕Մೳ
    ख਺ྉແྉ
    ※ϓϥοτϑΥʔϜҊ݅ͷ৔߹

    ചΓख
    1.ܝࡌ͢Δ
    ɾങ͍खͷM&AχʔζΛࣗΒௐ΂Δ͜ͱ͕Մೳ

    ɾ஥հۀऀΛհͣ͞ʹμΠϨΫτʹ΍ΓऔΓՄೳ

    ɾങ͍खͷM&A୲౰ऀʹ௚઀ίϯλΫτΛͱΕΔ

    ɾ஥հۀऀΛ࢖Θͳ͍ͷͰख਺ྉ͕ແྉ
    2.ΦϑΝʔ͢Δ
    M&Aɾग़ࢿχʔζΛܝࡌ
    ങ͍खͷϝϦοτ ചΓखͷϝϦοτ
    ɾ஥հۀऀΛ࢖Θͳ͍ͷͰख਺ྉ͕ແྉ
    ʓʓྖҬͷձࣾΛ
    ืू͠·͢
    ͜ͷձࣾͱҰॹʹ
    ΍͍͖͍ͬͯͨʂ
    3
    PR

    View full-size slide

  4. Copyright© M&A
    INDEX
    PHP




    PHP


    Composer Bin Command


    Packagist


    View full-size slide

  5. Copyright© M&A
    PHP

    View full-size slide

  6. Copyright© M&A
    PHP
    PHP
    🤔

    View full-size slide

  7. Copyright© M&A
    PHP
    M&A


    M&A

    View full-size slide

  8. Copyright© M&A
    ON/OFF


    if

    View full-size slide

  9. Copyright© M&A
    if


    FeatureFlag::isTrue()

    View full-size slide

  10. Copyright© M&A
    if


    FeatureFlag::isTrue()


    😵😭🤬🤯😨

    View full-size slide

  11. Copyright© M&A
    PHP
    php-del
    https://packagist.org/packages/kubotak-is/php-del
    PHP

    View full-size slide

  12. Copyright© M&A
    php-del.json


    dirs extensions
    php,blade.php,css,sass,scss,stylus

    View full-size slide

  13. Copyright© M&A
    php-del start flag ~ php-del end flag


    View full-size slide

  14. Copyright© M&A
    php-del start flag ~ php-del end flag


    View full-size slide

  15. Copyright© M&A
    Composer Bin Command

    View full-size slide

  16. Copyright© M&A
    Composer Bin Command

    View full-size slide

  17. Copyright© M&A
    Composer Bin Command
    🤗

    View full-size slide

  18. Copyright© M&A
    ⾒ php-del ignore start,end

    View full-size slide

  19. Copyright© M&A
    ⾒ php-del ignore start,end
    ignore

    View full-size slide

  20. Copyright© M&A
    ⾒ php-del line flag
    ⾒ php-del file flag

    View full-size slide

  21. Copyright© M&A
    ⾒ php-del line flag
    ⾒ php-del file flag


    GitHub
    🤩

    View full-size slide

  22. Copyright© M&A

    View full-size slide

  23. Copyright© M&A
    1
    ) start


    2
    ) start
    1


    3
    ) end


    4
    ) end


    5
    )

    View full-size slide

  24. Copyright© M&A
    1
    ) start


    2
    ) start
    1


    3
    ) end


    4
    ) end


    5
    )

    View full-size slide

  25. Copyright© M&A
    1
    ) start


    2
    ) start
    1


    3
    ) end


    4
    ) end


    5
    )
    1

    View full-size slide

  26. Copyright© M&A
    1
    ) start


    2
    ) start
    1


    3
    ) end


    4
    ) end


    5
    )

    View full-size slide

  27. Copyright© M&A
    1
    ) start


    2
    ) start
    1


    3
    ) end


    4
    ) end


    5
    )

    View full-size slide

  28. Copyright© M&A
    1
    ) start


    2
    ) start
    1


    3
    ) end


    4
    ) end


    5
    )

    View full-size slide

  29. Copyright© M&A
    ignore
    1
    )
    ignore
    start


    2
    )
    1


    3
    ) ignore end


    4
    )
    2

    View full-size slide

  30. Copyright© M&A
    ignore
    1
    )
    ignore
    start


    2
    )
    1


    3
    ) ignore end


    4
    )
    2

    View full-size slide

  31. Copyright© M&A
    ignore
    1
    )
    ignore
    start


    2
    )
    1


    3
    ) ignore end


    4
    )
    2
    1

    View full-size slide

  32. Copyright© M&A
    ignore
    1
    )
    ignore
    start


    2
    )
    1


    3
    ) ignore end


    4
    )
    2

    View full-size slide

  33. Copyright© M&A
    ignore
    1
    )
    ignore
    start


    2
    )
    1


    3
    ) ignore end


    4
    )
    2
    2

    View full-size slide

  34. Copyright© M&A
    ignore
    5)

    View full-size slide

  35. Copyright© M&A
    A: B:
    str_replace

    View full-size slide

  36. Copyright© M&A
    A: B:
    str_replace
    A: B:

    View full-size slide

  37. Copyright© M&A
    A: B:
    str_replace
    A: B:
    while


    file_put_contents
    🔁

    View full-size slide

  38. Copyright© M&A
    Composer Bin Command
    Composer Bin Command PHPer PHPUnit


    vendor/bin


    Composer Bin Command 🙏

    View full-size slide

  39. Copyright© M&A
    bin
    shebang PHP


    php-del


    View full-size slide

  40. Copyright© M&A
    bin
    shebang PHP


    php-del


    env php PATH PHP

    View full-size slide

  41. Copyright© M&A

    View full-size slide

  42. Copyright© M&A
    composer


    autoload

    View full-size slide

  43. Copyright© M&A
    autoload

    View full-size slide

  44. Copyright© M&A
    autoload

    View full-size slide

  45. Copyright© M&A
    autoload PSR-
    4


    CLImate
    https://climate.thephpleague.com

    View full-size slide

  46. Copyright© M&A
    composer.json bin


    vendor/bin/~

    View full-size slide

  47. Copyright© M&A
    composer.json bin


    vendor/bin/~
    2
    🤗

    View full-size slide

  48. Copyright© M&A
    Packagist
    composer install Packagist


    Packagist Composer


    Packagist Composer URL

    View full-size slide

  49. Copyright© M&A
    Packagist
    name
    Github
    description
    require
    autoload name
    Github
    license
    composer.json

    View full-size slide

  50. Copyright© M&A
    Packagist
    Packagist GitHub


    Submit GitHub

    View full-size slide

  51. Copyright© M&A
    Packagist
    Packagist GitHub


    Submit GitHub
    😎

    View full-size slide

  52. Copyright© M&A
    README.md 👇

    View full-size slide

  53. Copyright© M&A
    Badge Poser🚀
    https://poser.pugx.org
    Pakckagist Badge Poser README.md

    View full-size slide

  54. Copyright© M&A
    GitHub Actions
    GitHub Actions Actions Create status badge

    View full-size slide

  55. Copyright© M&A



    Composer Bin Command


    Packagist


    View full-size slide

  56. Copyright© M&A
    php-del

    View full-size slide

  57. Copyright© M&A
    Thanks for watching this :)

    View full-size slide