mastodon.uno è uno dei tanti server Mastodon indipendenti che puoi usare per partecipare al fediverso.
Mastodon.Uno è la principale comunità mastodon italiana. Con 77.000 iscritti è il più grande nodo Mastodon italiano: anima ambientalista a supporto della privacy e del mondo Open Source.

Statistiche del server:

6,3K
utenti attivi

#php

213 post174 partecipanti1 post oggi
PHP Weekly<p>I made a tiny PHPUnit extension for PSR-7, XML/HTML and JSON assertions</p><p><a href="https://github.com/stein197/phpunit-extended" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">github.com/stein197/phpunit-ex</span><span class="invisible">tended</span></a></p><p>Discussions: <a href="https://discu.eu/q/https://github.com/stein197/phpunit-extended" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">discu.eu/q/https://github.com/</span><span class="invisible">stein197/phpunit-extended</span></a></p><p><a href="https://mastodon.social/tags/php" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>php</span></a> <a href="https://mastodon.social/tags/programming" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>programming</span></a></p>
Reuben Walker aka mobileatom<p>Introducing Pretty Print HTML for PHP 8.4 <a href="https://flipboard.com/tag/php" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>PHP</span></a> <a href="https://flipboard.com/tag/html" class="mention hashtag" rel="nofollow noopener noreferrer" target="_blank">#<span>HTML</span></a></p><p><a href="https://shkspr.mobi/blog/2025/04/introducing-pretty-print-html-for-php-8-4/?utm_source=flipboard&amp;utm_medium=activitypub" rel="nofollow noopener noreferrer" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">shkspr.mobi/blog/2025/04/intro</span><span class="invisible">ducing-pretty-print-html-for-php-8-4/?utm_source=flipboard&amp;utm_medium=activitypub </span></a></p><p>Posted into SYMFONY FOR THE DEVIL <span class="h-card" translate="no"><a href="https://flipboard.com/@mobileatom/symfony-for-the-devil-allupr6jz" class="u-url mention" rel="nofollow noopener noreferrer" target="_blank">@<span>symfony-for-the-devil-mobileatom</span></a></span></p>
Android<br><br><a href="https://www.freelancer.com/projects/mobile-app-development/Enabled-Gulf-Thobe-Tailoring-App.html" rel="nofollow noopener noreferrer" target="_blank">https://www.freelancer.com/projects/mobile-app-development/Enabled-Gulf-Thobe-Tailoring-App.html</a><br><br><a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/Android" target="_blank">#Android</a> <a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/Graphic" target="_blank">#Graphic</a> <a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/Design" target="_blank">#Design</a> <a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/iPhone" target="_blank">#iPhone</a> <a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/Mobile" target="_blank">#Mobile</a> <a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/App" target="_blank">#App</a> <a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/Development" target="_blank">#Development</a> <a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/PHP" target="_blank">#PHP</a><br><br><a href="https://awakari.com/pub-msg.html?id=82v6cgayL4WG1By7mVISUnM7qds&amp;interestId=Android" rel="nofollow noopener noreferrer" target="_blank">Result Details</a>
javascript-job-alert<br><br><a href="https://www.freelancer.com/projects/php/Game-API-Integration-Specialist-Needed.html" rel="nofollow noopener noreferrer" target="_blank">https://www.freelancer.com/projects/php/Game-API-Integration-Specialist-Needed.html</a><br><br><a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/HTML" target="_blank">#HTML</a> <a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/JavaScript" target="_blank">#JavaScript</a> <a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/MySQL" target="_blank">#MySQL</a> <a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/PHP" target="_blank">#PHP</a> <a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/Website" target="_blank">#Website</a> <a rel="nofollow noopener noreferrer" class="mention hashtag" href="https://mastodon.social/tags/Design" target="_blank">#Design</a><br><br><a href="https://awakari.com/pub-msg.html?id=MXtcNhKaodqD1WhReeM9EebMc7M&amp;interestId=javascript-job-alert" rel="nofollow noopener noreferrer" target="_blank">Result Details</a>

Introducing Pretty Print HTML for PHP 8.4

shkspr.mobi/blog/2025/04/intro

I'm delight to announce the first release of my opinionated HTML Pretty Printer for new versions of PHP.

There are several prettifiers on Packagist, but I think mine is the only one which works with the new Dom\HTMLDocument class.

  • Table of Contents

  • What
  • How
  • Limitations
  • Why
  • Next Steps
  • What

    This takes hard-to-read HTML like:

    <!doctype html><html><head><meta charset="UTF-8"></head><body><div id="main" class="news main"><h1 id="top">Title</h1><p>How <em>exciting</em>!</p></div>

    And pretty-prints it with some opinionated formatting:

    <!doctype html><html>    <head>        <meta charset=UTF-8>    </head>    <body>        <div class="main news" id=main>            <h1 id=top>Title</h1>            <p>How <em>exciting</em>!</p>        </div>    </body></html>

    All elements are indented where possible. Attributes are sorted alphabetically. Attribute variables are unquoted if possible. CSS and JS are unaltered. These options are configurable.

    To get an idea of what it outputs, take a look at the source code of this page!

    How

    This is designed to be simple to use, but with enough options to be useful to as many people as possible.

    //  HTML as a string:$html = "<div>This is <span> an <em>example</em>";//  Or as a file:$html = file_get_contents( "example.html" );//  Turn the HTML into a Dom\HTMLDocument$dom = \Dom\HTMLDocument::createFromString( $html, LIBXML_NOERROR, "UTF-8" );//  Create the pretty printer$formatter = new Edent\PrettyPrintHtml\PrettyPrintHtml();//  Output the resultecho $formatter->serializeHtml( $dom );

    Limitations

    Whitespace is hard. There are many different types. Sometimes it is for display, sometimes it isn't. Adding extra newlines and tabs almost certainly will cause layout changes somewhere on your page.

    You can either change your CSS to minimise this, add elements to the preserveElements list to stop them being altered, or re-write your original HTML. The choice is yours.

    Why

    As was written long ago:

    A computer language is not just a way of getting a computer to perform operations but rather … it is a novel formal medium for expressing ideas about methodology. Thus, programs must be written for people to read, and only incidentally for machines to execute.

    PHP's new Dom\HTMLDocument class produces syntactically valid HTML code. The code is very easy for a computer to parse. But because there is no indenting, the code is difficult for a human to parse.

    Adding newlines and indents before every new element can introduce spacing errors when the HTML is rendered to screen. Some of these can be fixed with extra CSS, some cannot

    This pretty-printer attempts to make code readable for humans by striking a balance between legibility when rendered on screen or viewed as source code.

    Why is human readability so important?

    As Ana Rodrigues said:

    Today's heavily optimized websites have largely killed the "view source" learning experience. The code is minified, bundled, and often incomprehensible to beginners trying to understand how things work. […] I want anyone, regardless of skill level, to inspect elements, understand the structure, and learn from readable code.

    Using this pretty printer should give you and your users an excellent "view source" experience, without sacrificing the browser's ability to render the code.

    Next Steps

    I'm sure there are many bugs and oddities. I'd love you to report any problems on GitLab. Feel free to contribute test-cases and code.

    The HTML5 Logo.
    Terence Eden’s Blog · Introducing Pretty Print HTML for PHP 8.4
    Altro da Terence Eden

    Debugging PHP App Engine Applications Locally: A Guide to Troubleshooting MySQL Connections
    Debugging App Engine PHP deployments with MySQL often involves local environment discrepancies. Connection failures, like "No such file or directory," happen when your local setup doesn't match App Engine's Cloud SQL Proxy. Learn how to emulate the App Engine environment locally using the Cloud SQL Auth Proxy to fix these issues. #AppEngine #PHP #MySQL #Deployment #Troubleshooting #CloudSQL #GoogleC...