<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Džuris on Medium]]></title>
        <description><![CDATA[Stories by Džuris on Medium]]></description>
        <link>https://medium.com/@juris-9772?source=rss-6c7f494c570b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Džuris on Medium</title>
            <link>https://medium.com/@juris-9772?source=rss-6c7f494c570b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 21:29:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@juris-9772/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Adding your own fluent JSON assertions in Laravel]]></title>
            <link>https://juris-9772.medium.com/adding-your-own-fluent-json-assertions-in-laravel-6d1cd6eee68d?source=rss-6c7f494c570b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d1cd6eee68d</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Džuris]]></dc:creator>
            <pubDate>Sun, 30 May 2021 21:34:51 GMT</pubDate>
            <atom:updated>2021-05-31T11:07:28.506Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://laravel.com/docs/8.x/http-tests#fluent-json-testing">Fluent JSON testing</a> is an elegant feature that let’s you test JSON responses using a chain of calls and checking fields one by one. As shown in the docs:</p><pre>use Illuminate\Testing\Fluent\AssertableJson;<br>/* ...... */</pre><pre>$response = $this-&gt;json(&#39;GET&#39;, &#39;/users/1&#39;);<br><br>$response<br>    -&gt;assertJson(fn (AssertableJson $json) =&gt;<br>        $json-&gt;where(&#39;id&#39;, 1)<br>             -&gt;where(&#39;name&#39;, &#39;Victoria Faith&#39;)<br>             -&gt;missing(&#39;password&#39;)<br>             -&gt;etc()<br>    );</pre><p>But the toolkit provided by the AssertableJson class might fall short on some more specific cases and this article explains how you can extend the class with you own assertions. To do this we’ll have to provide a bit of boilerplate, but once it’s all in place, there’s no more friction and you can add all the features you need.</p><h3>Extending AssertableJson</h3><p>Adding methods is simple. Just extend the AssertableJson class and define (or override) the methods you need. I prefer to put this right besides where I use it — in Feature tests.</p><pre>// tests/Feature/AssertableJson.php<br>&lt;?php</pre><pre>namespace Tests\Feature;</pre><pre>use Arr;<br>use Illuminate\Testing\Fluent\AssertableJson as BaseAssertableJson;<br>use PHPUnit\Framework\Assert as PHPUnit;</pre><pre>class AssertableJson extends BaseAssertableJson<br>{<br>    /**<br>     * Check if at least one of these keys is present.<br>     */<br>    public function hasAny($keys): static<br>    {<br>        $keys = is_array($keys) ? $keys : func_get_args();</pre><pre>        PHPUnit::assertTrue(<br>           Arr::hasAny($this-&gt;prop(), $keys),<br>           sprintf(&#39;None of properties [%s] exist.&#39;, implode(&#39;, &#39;, $keys))<br>        );</pre><pre>        foreach ($keys as $key)<br>            $this-&gt;interactsWith($key);</pre><pre>        return $this;<br>    }<br>}</pre><p>This method follows conventions established by Laravel’s own AssertableJson methods:</p><ul><li>It uses a static PHPUnit’s assertion with a custom error message.</li><li>It uses interactsWith method to mark the keys that have been checked. Fluent JSON testing keeps track of keys that are checked and will fail the test if any unexpected keys remain, unless an -&gt;etc() is also added to the chain.</li><li>It returns the object itself so you can keep chaining.</li></ul><h3>Using your AssertableJson</h3><p>Now that we have a class defined we can use it in a custom response. Let us inject it in out TestResponse class and also use it to define a new custom assertion on this TestResponse class.</p><pre>// tests/Feature/TestResponse.php<br>&lt;?php</pre><pre>namespace Tests\Feature;</pre><pre>use Arr;<br>use Illuminate\Testing\TestResponse as BaseTestResponse;<br>// If you don&#39;t have your AssertableJson in the same namespace<br>// You have to import it or use FQCN.</pre><pre>class TestResponse extends BaseTestResponse<br>{<br>    /**<br>     * Inject our extension of AssertableJson.<br>     */<br>    public function assertJson($value, $strict = false)<br>    {<br>        $json = $this-&gt;decodeResponseJson();<br>        <br>        if (is_array($value)) {<br>            $json-&gt;assertSubset($value, $strict);<br>        } else {<br>            $assert = AssertableJson::fromAssertableJsonString($json);<br>            $value($assert);<br>    <br>            if (Arr::isAssoc($assert-&gt;toArray())) {<br>                $assert-&gt;interacted();<br>            }<br>        }</pre><pre>        return $this;<br>    }</pre><pre>    /**<br>     * Some rudimentary checking to see if this resembles JSON API.<br>     */<br>    public function assertIsJsonApi()<br>    {<br>        $this-&gt;assertJson(fn(AssertableJson $json) =&gt;<br>            $json<br>                // One of these is required in JSON API.<br>                -&gt;hasAny(&#39;data&#39;, &#39;errors&#39;, &#39;meta&#39;)<br>                // All of these are allowed and this will be true because of<br>                // previous. We include it to explicitly name all allowed<br>                // params and let the test fail if anything else is present.<br>                -&gt;hasAny(&#39;data&#39;, &#39;errors&#39;, &#39;meta&#39;, &#39;jsonapi&#39;, &#39;links&#39;, &#39;included&#39;)<br>            );</pre><pre>        return $this;<br>    }<br>}</pre><p>Once this is done we can make a custom TestCase and use our new TestResponse.</p><pre>// tests/Feature/TestCase.php<br>&lt;?php</pre><pre>namespace Tests\Feature;</pre><pre>use Tests\TestCase as BaseTestCase;<br>// import TestResponse if not in the same namespace</pre><pre>abstract class TestCase extends BaseTestCase<br>{<br>    /**<br>     * Inject our extension of TestResponse.<br>     */<br>    protected function createTestResponse($response)<br>    {<br>        return TestResponse::fromBaseResponse($response);<br>    }<br>}</pre><p>Finally we can use it in our tests.</p><pre>// tests/Feature/SomeJsonTest.php<br>&lt;?php</pre><pre>namespace Tests\Feature;</pre><pre>// import our new TestCase and AssertableJson if not same namespace</pre><pre>class ContentTest extends TestCase<br>{<br>    public function testContents()<br>    {<br>        $this-&gt;getJson(&#39;flintstones&#39;)<br>            -&gt;assertJson(fn(AssertableJson $json) =&gt;<br>                $json<br>                    -&gt;hasAny(&#39;Fred&#39;, &#39;Wilma&#39;, &#39;Pebbles&#39;)<br>                    -&gt;missingAll(&#39;Barney&#39;, &#39;Betty&#39;)<br>            );<br>    }</pre><pre>    public function testFormat()<br>    {<br>        $this-&gt;getJson(&#39;parking-lots&#39;)<br>            -&gt;assertStatus(200)<br>            -&gt;assertIsJsonApi(); // custom response assertion<br>    }<br>}</pre><blockquote>Note: make sure to have your Laravel updated before trying. This only works since Laravel 8.42. The process was more cumbersome before <a href="https://github.com/laravel/framework/pull/37380">this PR</a>.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d1cd6eee68d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Serving Laravel from a subdirectory]]></title>
            <link>https://juris-9772.medium.com/serving-laravel-from-a-subdirectory-a8a1adac7ce7?source=rss-6c7f494c570b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8a1adac7ce7</guid>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Džuris]]></dc:creator>
            <pubDate>Tue, 27 Oct 2020 10:31:33 GMT</pubDate>
            <atom:updated>2020-10-27T10:58:08.930Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="An image so medium doesn’t show some stock photo on previews." src="https://cdn-images-1.medium.com/max/1024/1*_m5_jvGvr9q0tM-B_g6Bqg.png" /></figure><p>Oficially Laravel can not be served from a subdirectory. In practice it’s just a matter of proper setup.</p><p>I was browsing the issues on Laravel repo and came across <a href="https://github.com/laravel/framework/issues/34977">one</a> complaining about issues that arise from serving Laravel out of a subdirectory. Turns out there <a href="https://github.com/laravel/framework/issues/32236#issuecomment-692546842">are</a> <a href="https://github.com/laravel/framework/issues/32082#issuecomment-604986571">multiple</a> such reports and the official answer is just that it’s not supported. Even the <a href="https://laravel.com/docs/8.x#directory-configuration">documentation states</a>:</p><blockquote>Laravel should always be served out of the root of the “web directory” configured for your web server.</blockquote><p>In fact there are no problems with serving it from a subdirectory as long as you take some care to set up the server and Laravel properly.</p><p>The key idea is that you should not hide your setup from Laravel. Don’t put Laravel in an actual subfolder, serve from example.com/subdirectory/public and expect Laravel to treat that as a base. You should instead redirect example.com/subdirectory to your Laravel app, provide Laravel with the full URI (including /subdirectory) and configure it to handle requests that start with that prefix.</p><p>At that point it’s no different for Laravel than serving it from root but only receiving and handling requests with prefixed routes. But the difference for you is that you can serve something else without the prefix. Here are some examples for common setups.</p><h3>Admin panel in a subdirectory</h3><p>Let us consider the following setup. You have a Linux server with Nginx. You are willing to serve a SPA frontend from/srv/frontend onexample.com and a Laravel administration panel from/srv/admin on example.com/admin.</p><h4>Server configuration</h4><p>You should instruct Nginx to serve any requests to example.com/admin to the Laravel app:</p><pre>server {<br>    listen 443 ssl http2;<br>    # do your tls setup, gzip, logging etc</pre><pre>    server_name example.com;</pre><pre>    index index.html;<br>    root /srv/frontend;</pre><pre>    location /admin {<br>        alias /srv/admin/public;<br>        index index.php;</pre><pre>        try_files $uri /index.php?$query_string;<br>    }</pre><pre>    location ~ \.php$ {<br>        # do your PHP setup<br>    }<br>}</pre><p>Important detail to note is the alias directive. It means that Nginx will serve example.com/admin from /srv/admin/public. If we used root instead, Nginx would append the URI to it and try to serve from /srv/admin/public/admin.</p><p>Note: you should not have any directory starting with the string public… (apart from public dir itself) like public_enemy in your Laravel directory, otherwise it will be served on example.com/admin_enemy. If you do have something like that, see this <a href="https://serverfault.com/a/476368/215906">answer</a> on SF.</p><h4>Laravel configuration</h4><p>In your routes/web.php wrap everything in a prefix group so Laravel handles the /admin routes:</p><pre>Route::prefix(&#39;admin&#39;)-&gt;group(function () {<br>    // Your routes here<br>});</pre><h3>SPA with an API in subdirectory</h3><p>You have a Linux server with Nginx. You are willing to serve a SPA frontend from/srv/frontend onexample.com and a Laravel API from/srv/api on example.com/api.</p><h4>Nginx configuration</h4><pre>server {<br>    listen 443 ssl http2;<br>    # do your tls setup, gzip, logging etc</pre><pre>    server_name example.com;</pre><pre>    index index.html;<br>    root /srv/frontend;</pre><pre>    location /api {<br>        alias /srv/api/public;<br>        index index.php;</pre><pre>        try_files $uri /index.php?$query_string;<br>    }</pre><pre>    location ~ \.php$ {<br>        # do your PHP setup<br>    }<br>}</pre><p>And you are done. No need for any Laravel setup because the routes in routes/api.php have an api prefix by default. If you still need assets, replace that root with an alias.</p><h3>Still here?</h3><p>Check out some of my silly projects on Laravel and Nginx:</p><ul><li><a href="https://github.com/Crudly/Encrypted">Custom cast classes for encryption and hashing</a></li><li><a href="https://github.com/GlaivePro/Hidevara">Prevent your variables from getting dumped</a></li><li><a href="https://github.com/tontonsb/NGINX-snippets">Clean up your Nginx setup</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8a1adac7ce7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel package ecosystem]]></title>
            <link>https://itnext.io/laravel-package-ecosystem-4afd53fad192?source=rss-6c7f494c570b------2</link>
            <guid isPermaLink="false">https://medium.com/p/4afd53fad192</guid>
            <category><![CDATA[composer]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel-packages]]></category>
            <category><![CDATA[package]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Džuris]]></dc:creator>
            <pubDate>Tue, 02 Jun 2020 01:25:13 GMT</pubDate>
            <atom:updated>2020-06-05T13:27:52.116Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="PHP frameworks and number of their active packages. Laravel leads with 44k, followed by Symfony at 36k and Yii at nearly 15k." src="https://cdn-images-1.medium.com/max/1024/1*VGeW3SX2eTQpReYKyk0X6w.png" /></figure><p>Packages play a big role in the <a href="https://laravel.com/">Laravel</a> scene. How big and which packages? To find it out we took the data from the <a href="https://packagist.org/">Packagist.org</a> API and filtered out the Laravel packages.</p><p>How did we identify the Laravel packages? By looking at composer.json. We classified a package as belonging to the Laravel ecosystem if name, description, keywords or type fields contained the string laravel. We also considered it to be a <em>Laravel</em> package if it has laravel/framework or any of the illuminate/* subtree splits as a dependancy. And finally — the laravel key in extra field is also a trigger.</p><p>While these criteria do not guarantee a package to be Laravel-only, they do show that the package was made with Laravel in mind.</p><h3>The most popular packages</h3><p>By naively looking at the <a href="https://github.com/Larzs/packagist-packages-data/blob/master/results/top-montly-packages_laravel.json">list of the most downloaded packages</a>, we see quite a bit of unexciting results — core packages and packages with a plenty of uses outside Laravel projects.</p><pre>| Package                 | Monthly downloads |<br>|-------------------------|-------------------|<br>| nesbot/carbon           | 4084214           |<br>| laravel/framework       | 2987907           |<br>| laravel/tinker          | 2455355           |<br>| fideloper/proxy         | 2376631           |<br>| nunomaduro/collision    | 1510258           |<br>| intervention/image      | 1099989           |<br>| facade/ignition         | 966800            |<br>| facade/flare-client-php | 934651            |<br>| composer/installers     | 803222            |<br>| illuminate/support      | 756189            |</pre><p>Perhaps a more interesting toplist would be one with these “false positives” removed. We manually filtered out the top 30 packages that are made for Laravel projects and are installed deliberately. We also loosely classified the purposes of those packages.</p><pre>|    | Package                      | Monthly | Total    | Purpose |<br>|----|------------------------------|---------|----------|---------|<br>| 1  | maatwebsite/excel            | 680466  | 17769696 | port    |<br>| 2  | laravelcollective/html       | 678048  | 21785383 | helper  |<br>| 3  | barryvdh/laravel-ide-helper  | 644297  | 18918427 | dev     |<br>| 4  | barryvdh/laravel-debugbar    | 625080  | 19404288 | dev     |<br>| 5  | laravel/passport             | 552633  | 10099903 | auth    |<br>| 6  | beyondcode/laravel-dump-s... | 530901  | 11035024 | dev     |<br>| 7  | sentry/sentry-laravel        | 455879  | 8440070  | integ   |<br>| 8  | laravel/ui                   | 433850  | 1599042  | auth    |<br>| 9  | barryvdh/laravel-cors        | 400920  | 10823255 | helper  |<br>| 10 | laravel/socialite            | 394471  | 10166784 | auth    |<br>| 11 | laravel/slack-notificatio... | 385921  | 7172937  | integ   |<br>| 12 | tymon/jwt-auth               | 359693  | 9107092  | auth    |<br>| 13 | barryvdh/laravel-dompdf      | 349572  | 8006731  | port    |<br>| 14 | laravel/helpers              | 337956  | 1692185  | helper  |<br>| 15 | spatie/laravel-permission    | 308453  | 5224001  | auth    |<br>| 16 | laravel/horizon              | 304864  | 4599598  | integ   |<br>| 17 | laravel/dusk                 | 256261  | 4542482  | dev     |<br>| 18 | laravel/nexmo-notificatio... | 238192  | 6080124  | integ   |<br>| 19 | laravel/telescope            | 227966  | 2289576  | dev     |<br>| 20 | bugsnag/bugsnag-laravel      | 223167  | 6544766  | dev     |<br>| 21 | yajra/laravel-datatables-... | 212985  | 5644721  | integ   |<br>| 22 | aws/aws-sdk-php-laravel      | 212260  | 7070121  | integ   |<br>| 23 | orchestra/testbench-core     | 199780  | 1864659  | dev     |<br>| 24 | orchestra/testbench          | 195269  | 2279889  | dev     |<br>| 25 | symplify/package-builder     | 193661  | 1484783  | dev     |<br>| 26 | laravel/scout                | 177270  | 3391042  | integ   |<br>| 27 | barryvdh/laravel-snappy      | 156741  | 3651684  | port    |<br>| 28 | webpatser/laravel-uuid       | 153883  | 4774711  | helper  |<br>| 29 | spatie/laravel-medialibrary  | 149290  | 2293823  | helper  |<br>| 30 | spatie/laravel-activitylog   | 148932  | 2387978  | dev     |</pre><pre>The ones who had to be cut off to fit: <br>- beyondcode/laravel-dump-server<br>- laravel/slack-notification-channel<br>- laravel/nexmo-notification-channel<br>- yajra/laravel-datatables-oracle</pre><p>Explanation of purposes:</p><ul><li><strong>auth</strong> — authentication and authorization</li><li><strong>dev</strong> — development and debugging tools</li><li><strong>helper</strong> — support and simplifaction of work</li><li><strong>integ</strong> — integration with other services</li><li><strong>port</strong> — import and/or export in various forma</li></ul><p>The development tools are most prevalent on this list followed by integration.</p><figure><img alt="Porportions of package types and their monthly downloads summed by packge type from the above table." src="https://cdn-images-1.medium.com/max/1024/0*D7pEc03MBJbi5a9k" /></figure><p>We expeceted to see more of the <a href="https://spatie.be/open-source/packages">Spatie</a> packages at the very top, but it turns out that maatwebsite/excel and the tools by <a href="https://github.com/barryvdh">Barry vd. Heuvel</a> are more universally used.</p><h3>Vendor overview</h3><p>In total there were 47337 Laravel packages identified from 23167 different developers. The distribution is quite even with lots and lots of small players.</p><p>Half of packages (23668) were made by the top 3927 developers which is far more than would be if <a href="https://dariusforoux.com/prices-law/">Price’s law</a> was obeyed here. 15042 of the developers have only one package published.</p><p>If we sort package developers by number of packages, we get to see some quite unheard names. Here are the most prolific package developers along with the download numbers summed over their packages.</p><pre>|    | Developer              | Count | Daily | Monthly | Total    |<br>|----|------------------------|-------|-------|---------|----------|<br>| 1  | socialiteproviders     | 159   | 10645 | 256409  | 5826725  |<br>| 2  | bantenprov             | 132   | 0     | 5       | 3160     |<br>| 3  | spatie                 | 124   | 89124 | 2746665 | 43095685 |<br>| 4  | railken                | 119   | 0     | 11082   | 313129   |<br>| 5  | laravel-enso           | 95    | 1519  | 29456   | 879635   |<br>| 6  | amethyst               | 92    | 1232  | 8118    | 100819   |<br>| 7  | faustbrian             | 85    | 152   | 2639    | 52698    |<br>| 8  | artisanry              | 78    | 129   | 1190    | 11938    |<br>| 9  | sukohi                 | 75    | 58    | 1773    | 53805    |<br>| 10 | anomaly                | 59    | 198   | 6095    | 974489   |<br>| 11 | sanatorium             | 59    | 0     | 0       | 20       |<br>| 12 | laravel-notificatio... | 54    | 3107  | 99536   | 1621420  |<br>| 13 | hnhdigital-os          | 54    | 38    | 1571    | 20304    |<br>| 14 | arcanedev              | 53    | 3875  | 127702  | 3293360  |<br>| 15 | inetstudio             | 53    | 241   | 3870    | 77009    |<br>| 16 | larakit                | 49    | 1     | 410     | 18540    |<br>| 17 | orchestra              | 48    | 21569 | 544696  | 7606461  |<br>| 18 | abuseio                | 45    | 1     | 951     | 78289    |<br>| 19 | genealabs              | 43    | 3219  | 87234   | 1215349  |<br>| 20 | smorken                | 41    | 36    | 985     | 14277    |</pre><pre>laravel-notification-channels had to be cut off</pre><p>Apparently there are quite a few developers who make a lot of components and put them up without much advertisement. To see more of the better known names and how they compare, let us sort the list by total downloads.</p><pre>|    | Developer         | Count | Daily  | Monthly | Total     |<br>|----|-------------------|-------|--------|---------|-----------|<br>| 1  | laravel           | 39    | 364375 | 9832728 | 225867755 |<br>| 2  | illuminate        | 33    | 244509 | 7210832 | 197044965 |<br>| 3  | nesbot            | 1     | 179106 | 4084214 | 112631927 |<br>| 4  | barryvdh          | 19    | 82289  | 2246578 | 63115434  |<br>| 5  | spatie            | 124   | 89124  | 2746665 | 43095685  |<br>| 6  | fideloper         | 3     | 100748 | 2376631 | 41313378  |<br>| 7  | intervention      | 7     | 46259  | 1260102 | 33891504  |<br>| 8  | composer          | 1     | 10603  | 803222  | 26065561  |<br>| 9  | league            | 7     | 18996  | 731742  | 24433630  |<br>| 10 | nunomaduro        | 19    | 68333  | 1734552 | 23394056  |<br>| 11 | laravelcollective | 6     | 32460  | 710099  | 23285426  |<br>| 12 | maatwebsite       | 6     | 27955  | 717140  | 18258360  |<br>| 13 | cocur             | 1     | 19246  | 491761  | 16609476  |<br>| 14 | jenssegers        | 15    | 24263  | 544700  | 16468485  |<br>| 15 | beyondcode        | 29    | 14221  | 677724  | 12648233  |<br>| 16 | laracasts         | 11    | 10352  | 317232  | 12119703  |<br>| 17 | graham-campbell   | 36    | 11092  | 291114  | 10184667  |<br>| 18 | facade            | 5     | 67794  | 1915933 | 9860242   |<br>| 19 | yajra             | 19    | 17794  | 446360  | 9792222   |<br>| 20 | tymon             | 2     | 11437  | 359693  | 9107116   |</pre><p>If one sorts this list by monthly dowloads instead, the picture is slightly different.</p><pre>|    | Developer         | Count | Daily  | Monthly | Total     |<br>|----|-------------------|-------|--------|---------|-----------|<br>| 1  | laravel           | 39    | 364375 | 9832728 | 225867755 |<br>| 2  | illuminate        | 33    | 244509 | 7210832 | 197044965 |<br>| 3  | nesbot            | 1     | 179106 | 4084214 | 112631927 |<br>| 4  | spatie            | 124   | 89124  | 2746665 | 43095685  |<br>| 5  | fideloper         | 3     | 100748 | 2376631 | 41313378  |<br>| 6  | barryvdh          | 19    | 82289  | 2246578 | 63115434  |<br>| 7  | facade            | 5     | 67794  | 1915933 | 9860242   |<br>| 8  | nunomaduro        | 19    | 68333  | 1734552 | 23394056  |<br>| 9  | intervention      | 7     | 46259  | 1260102 | 33891504  |<br>| 10 | composer          | 1     | 10603  | 803222  | 26065561  |</pre><p>These distributions are extremely top heavy. Regardless if you order by daily, monthly or total downloads, more than half of all downloads go to top 6 package developers. For example, out of 5.65 million daily package downloads, 2.85 million are split among <a href="https://packagist.org/packages/laravel/">laravel</a>, <a href="https://packagist.org/packages/illuminate/">illuminate</a>, <a href="https://packagist.org/packages/nesbot/">nesbot</a>, <a href="https://packagist.org/packages/spatie/">spatie</a>, <a href="https://packagist.org/packages/fideloper/">fideloper</a> and <a href="https://packagist.org/packages/barryvdh/">barryvdh</a>.</p><p>We can use something a kin to <a href="https://en.wikipedia.org/wiki/H-index">Hirsch index</a> to assess the depth of the scene. There are only 317 developers that get 317 or more daily downloads. 1118 vendors get 1118 or more monthly downloads and the same number is 3003 for total numbers.</p><h3>Licensing choices</h3><p>Our licensing overview is not very precise as various strings are used for the same license, for example gpl-3.0, gpl 3.0, gpl3, gplv3, even gnu general public license version 3 and many more for the same license.</p><figure><img alt="79% of Laravel packages are MIT licensed, 14% are unlicensed. GPL, Apache and BSD variants apply to 1–2% of packages." src="https://cdn-images-1.medium.com/max/600/1*qOhNIylntiUWsfwtqt912w.png" /></figure><p>Luckily, the main conclusions are clear as the string mit is the license of 37502 Laravel packages. 6304 packages are unlicensed, More than 500 packages are licensed under each of Apache 2.0 and GPL 3.0. And there are also few hundred packages with BSD 2, BSD 3 and GPL 2.0.</p><p>79% of Laravel packages are MIT-licensed, 14% are unlicensed and the other licenses are each used in used in 2% of projects or less. This is probably in part influenced by Laravel which itself is MIT licensed. Among all of the packages the prevalence of the MIT license is considerably smaller — 60%.</p><figure><img alt="60% of all packages are MIT licensed, 15% are unlicensed, 8% GPL, 7% BSD, 3.5% Apache, 2% LGPL, 1% OSL." src="https://cdn-images-1.medium.com/max/600/0*--Hko4bjlIjhYKV2" /></figure><h3>Outside Laravel</h3><p>The number of packages for different frameworks shows the involvment of the community in the development of the framework tools and how much they are willing to share their code with others. We also counted the abandoned packages and their percentage to see which communities are thriving and which are limping.</p><pre>|    | Framework     | Packages | Abandoned | Aband. % |<br>|----|---------------|----------|-----------|----------|<br>| 1  | Laravel       | 47337    | 2618      | 5,5%     |<br>| 2  | Symfony       | 39428    | 3362      | 8,5%     |<br>| 3  | Yii           | 15354    | 552       | 3,6%     |<br>| 4  | ZendFramework | 7459     | 790       | 10,6%    |<br>| 5  | WordPress     | 6446     | 480       | 7,4%     |<br>| 6  | Nette         | 3460     | 342       | 9,9%     |<br>| 7  | CakePHP       | 2607     | 173       | 6,6%     |<br>| 8  | Slim          | 1411     | 64        | 4,5%     |<br>| 9  | Laminas       | 811      | 17        | 2,0%     |<br>| 10 | Phalcon       | 726      | 40        | 5,5%     |<br>| 11 | Codeigniter   | 663      | 91        | 13,7%    |<br>| 12 | Aura          | 450      | 32        | 7,1%     |<br>| 13 | Kohana        | 341      | 43        | 12,6%    |<br>| 14 | FuelPHP       | 148      | 12        | 8,1%     |<br>| 15 | PHPixie       | 73       | 1         | 1,4%     |</pre><figure><img alt="Number of active packages: total packages with abandoned subtracted from the above table." src="https://cdn-images-1.medium.com/max/1024/0*EBbSmzwLbvm51YgZ" /></figure><p>On the other hand, the total download numbers are reflective of how much the packages are important in the development of everyday projects.</p><p>Please keep in mind that these download numbers represent all of the packages related to a framework not just the core. It’s just like the number of packages listed above. The criteria for classifying a package as belonging to certain framework are <a href="https://github.com/Larzs/packagist-packages-data/blob/master/criteria.js">here</a>. One package can belong to ecosystems of multiple frameworks.</p><pre>|    | Framework     | Monthly   | Total      |<br>|----|---------------|-----------|------------|<br>| 1  | Symfony       | 366029776 | 8945189030 |<br>| 2  | Laravel       | 56523199  | 1315681505 |<br>| 3  | ZendFramework | 50789083  | 1460984224 |<br>| 4  | Nette         | 14137793  | 295710951  |<br>| 5  | Laminas       | 9540512   | 134960483  |<br>| 6  | Yii           | 5662063   | 200378585  |<br>| 7  | CakePHP       | 4067892   | 112091915  |<br>| 8  | WordPress     | 3871828   | 96962490   |<br>| 9  | Slim          | 2123558   | 46196613   |<br>| 10 | FuelPHP       | 930846    | 32043126   |<br>| 11 | Codeigniter   | 919926    | 30474042   |<br>| 12 | Kohana        | 912106    | 31918403   |<br>| 13 | Aura          | 467771    | 18063339   |<br>| 14 | Phalcon       | 137762    | 4322810    |<br>| 15 | PHPixie       | 5353      | 572100     |</pre><figure><img alt="Numbers of monthly and total downloads of packages by framework. Exactly the same data as in the table above." src="https://cdn-images-1.medium.com/max/1024/0*lQoZGZ5TwIENzqyM" /></figure><p>It should be noted that the top position doesn’t mean Symfony projects download the most packages as some of the Symfony core is used by Laravel and many of the Symfony packages can also be used in Laravel projects.</p><p>It is also noteworthy that Zend packages have almost as many monthly downloads as Laravel even though the project is no longer maintained.</p><p>As a farewell we shall leave you with the list of most downloaded PHP packages overall.</p><pre>|    | Package                           | Monthly | Total     |<br>|----|-----------------------------------|---------|-----------|<br>| 1  | symfony/polyfill-mbstring         | 7943600 | 210645235 |<br>| 2  | psr/log                           | 7768451 | 238663129 |<br>| 3  | symfony/polyfill-ctype            | 7284741 | 110601284 |<br>| 4  | psr/container                     | 6847606 | 119345271 |<br>| 5  | symfony/console                   | 6713344 | 199367074 |<br>| 6  | guzzlehttp/guzzle                 | 6607580 | 168514253 |<br>| 7  | symfony/finder                    | 6486878 | 176261290 |<br>| 8  | psr/http-message                  | 6384401 | 164860087 |<br>| 9  | guzzlehttp/promises               | 6372505 | 149984782 |<br>| 10 | guzzlehttp/psr7                   | 6350221 | 161806561 |<br>| 11 | doctrine/instantiator             | 6199120 | 180684872 |<br>| 12 | symfony/process                   | 6167368 | 169254030 |<br>| 13 | phpdocumentor/reflection-docblock | 6140913 | 165150240 |<br>| 14 | monolog/monolog                   | 6109702 | 196673732 |<br>| 15 | symfony/event-dispatcher          | 6098870 | 190433052 |<br>| 16 | webmozart/assert                  | 5905460 | 144395517 |<br>| 17 | doctrine/lexer                    | 5895066 | 157678399 |<br>| 18 | ralouphie/getallheaders           | 5861396 | 66293788  |<br>| 19 | doctrine/inflector                | 5743593 | 171588858 |<br>| 20 | phpdocumentor/type-resolver       | 5706391 | 136101740 |</pre><p>The data displayed in this article was compiled mainly by Gatis Šūpulnieks in April and May of 2020 as a part of his thesis “Laravel package development and usage”.</p><p>Relevant sources:</p><ul><li>Raw data <a href="https://github.com/Larzs/packagist-packages-data">https://github.com/Larzs/packagist-packages-data</a></li><li>Related article by Jason McCreary <a href="https://jasonmccreary.me/articles/laravel-numbers/">https://jasonmccreary.me/articles/laravel-numbers/</a></li><li>Author of this article: <a href="https://twitter.com/TontonsB">Juris Evertovskis</a></li><li>Compiler of data: <a href="https://twitter.com/larzsss">Gatis Šūpulnieks</a></li><li>Our newest micropackage <a href="https://github.com/crudly/encrypted">https://github.com/crudly/encrypted</a></li><li>The package made by Gatis <a href="https://github.com/GlaivePro/Invytr">https://github.com/GlaivePro/Invytr</a></li><li>Our silliest and most popular package: <a href="https://github.com/GlaivePro/Hidevara">https://github.com/GlaivePro/Hidevara</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4afd53fad192" width="1" height="1" alt=""><hr><p><a href="https://itnext.io/laravel-package-ecosystem-4afd53fad192">Laravel package ecosystem</a> was originally published in <a href="https://itnext.io/">ITNEXT</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>