<?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 Dipesh Sukhia on Medium]]></title>
        <description><![CDATA[Stories by Dipesh Sukhia on Medium]]></description>
        <link>https://medium.com/@dipeshsukhia?source=rss-22de94e76319------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*FhNKdzavCaGGTSFsccNW_Q.jpeg</url>
            <title>Stories by Dipesh Sukhia on Medium</title>
            <link>https://medium.com/@dipeshsukhia?source=rss-22de94e76319------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 19:45:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dipeshsukhia/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[Laravel REST API Develop(Generate)]]></title>
            <link>https://dipeshsukhia.medium.com/laravel-rest-api-develop-441538a65fd5?source=rss-22de94e76319------2</link>
            <guid isPermaLink="false">https://medium.com/p/441538a65fd5</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[laravel-packages]]></category>
            <category><![CDATA[laravel-rest-api]]></category>
            <dc:creator><![CDATA[Dipesh Sukhia]]></dc:creator>
            <pubDate>Tue, 19 Jul 2022 12:36:48 GMT</pubDate>
            <atom:updated>2022-07-19T12:39:10.389Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently launched a new <a href="https://github.com/dipeshsukhia/laravel-api-develop">package </a>that gives you a powerful setup for REST API in comfortable Laravel syntax using Laravel`s own standard.</p><h3>What Cover in this package?</h3><p>below is the functionality covered in this package</p><ol><li>API route</li><li>API resource ( Controller )</li><li>Form Request</li><li>API Resource</li><li>API Collection</li><li>API Response using Macro</li><li>API Exception Handler</li></ol><h3>Github</h3><p><a href="https://github.com/dipeshsukhia/laravel-api-develop">GitHub - dipeshsukhia/laravel-api-develop: develop rest apis for laravel</a></p><h3>Installation</h3><p>you can install the package via composer:</p><pre>composer require dipeshsukhia/laravel-api-develop</pre><h3>Usage</h3><p>install default configuration</p><pre>php artisan develop-api:install</pre><p>use trait in App\Exceptions\Handler.php</p><pre>use App\Exceptions\Traits\ApiHandlerTrait;<br><br>class Handler extends ExceptionHandler<br>{<br>    use ApiHandlerTrait;</pre><pre>php artisan develop-api --model=User</pre><h3><strong>How to use it?</strong></h3><p>You have to create the laravel database model and its migration and need to run <strong>php artisan develop-api — model=ModelName </strong>for generating or developing apis.</p><p>it will generate an API route, form request, API controller, API resource, and API collection based on Laravel standards.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=441538a65fd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel Eloquent Query Cache]]></title>
            <link>https://dipeshsukhia.medium.com/laravel-eloquent-query-cache-42da1f555124?source=rss-22de94e76319------2</link>
            <guid isPermaLink="false">https://medium.com/p/42da1f555124</guid>
            <category><![CDATA[query-cache]]></category>
            <category><![CDATA[laravel-development]]></category>
            <category><![CDATA[laravel-performance]]></category>
            <dc:creator><![CDATA[Dipesh Sukhia]]></dc:creator>
            <pubDate>Tue, 28 Sep 2021 11:58:09 GMT</pubDate>
            <atom:updated>2021-09-28T11:58:09.880Z</atom:updated>
            <content:encoded><![CDATA[<p>Enhances your laravel project database performance by using Query Cache.</p><p>You can <strong>Improve Laravel Database Performance </strong>without doing much more changes.</p><p>you need to install <a href="https://github.com/renoki-co/laravel-eloquent-query-cache"><strong>https://github.com/renoki-co/laravel-eloquent-query-cache</strong></a><strong> </strong>package.</p><p>and add below trait file in your project.</p><pre>&lt;?php<br><br>namespace App\Traits;<br>use Rennokki\QueryCache\Traits\QueryCacheable;<br>trait ModelQueryCacheable<br>{<br>    use QueryCacheable;<br><br>  <em>/**<br>  * </em><strong><em>@var </em></strong><em>float|int <br>  * cache for 1 day<br>  */<br>   </em>public $cacheFor = 60*60*24;<br>   <em>/**<br>   * </em><strong><em>@var </em></strong><em>string <br>   * cache file prefix<br>   */</em><br>    public $cacheTags = [<br>        self::class<br>    ];<br>    public $cacheDriver = &#39;file&#39;;<br><br>    <em>/**<br>     * Set the base cache tags that will be present<br>     * on all queries.<br>     *<br>     * </em><strong><em>@return </em></strong><em>array<br>     * //User::flushQueryCache(); via this you can clear all cache of this model<br>     */<br>    </em>protected function getCacheBaseTags(): array<br>    {<br>        return [<br>            &#39;global&#39;.strtolower(class_basename(self::class)),<br>        ];<br>    }<br><br>    <em>/**<br>     * </em><strong><em>@var </em></strong><em>bool<br>     * When you set up the $flushCacheOnUpdate property, the package attaches an observer to your model and any created, updated, deleted, forceDeleted or restored event will trigger the cache invalidation.<br>     */<br>    </em>protected static <em>$flushCacheOnUpdate </em>= true;<br><br>    <em>/**<br>     * </em><strong><em>@param </em></strong><em>null $relation<br>     * </em><strong><em>@param </em></strong><em>null $pivotedModels<br>     * </em><strong><em>@return </em></strong><em>string[]<br>     */<br>    </em>public function getCacheTagsToInvalidateOnUpdate($relation = null, $pivotedModels = null): array<br>    {<br>        return [<br>            &quot;page:{$this-&gt;id}&quot;,<br>            &#39;pages&#39;,<br>        ];<br>    }<br>}</pre><p>After you need to use this trait in every model like below. And rest things remain as it is.</p><pre>&lt;?php<br>namespace App\Models;<br><br>use App\Traits\ModelQueryCacheable;<br>use Illuminate\Database\Eloquent\Factories\HasFactory;<br>use Illuminate\Database\Eloquent\Model;<br><br>class UserBook extends Model<br>{<br>    use HasFactory, ModelQueryCacheable;<br>    protected $fillable = [<br>        &#39;name&#39;,&#39;user_id&#39;<br>    ];<br>}</pre><p>Now you can check database-related performance using <a href="https://github.com/barryvdh/laravel-debugbar"><strong>laravel-debugbar</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=42da1f555124" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel View Composer duplicating SQL queries for every view bind. How it runs once?]]></title>
            <link>https://dipeshsukhia.medium.com/laravel-view-composer-duplicating-sql-queries-for-every-view-bind-how-it-runs-once-2e429db3b003?source=rss-22de94e76319------2</link>
            <guid isPermaLink="false">https://medium.com/p/2e429db3b003</guid>
            <category><![CDATA[laravel-framework]]></category>
            <category><![CDATA[laravel-view-composer]]></category>
            <dc:creator><![CDATA[Dipesh Sukhia]]></dc:creator>
            <pubDate>Wed, 24 Feb 2021 11:56:56 GMT</pubDate>
            <atom:updated>2021-02-24T12:13:31.440Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why does this happen?</h3><p>The <a href="https://github.com/laravel/framework/blob/5.0/src/Illuminate/View/View.php#L102">Illuminate\View\View::renderContents()</a> the method is responsible for calling the composer bound to a view, and since any form of view rendering (Blade template inheritance or simple @include statements) executes that method, it means that when any view is rendered any composer bound to it gets triggered.</p><p>Since in case when using a * wildcard to bind all views, if the page renders ten views, the composer will get executed ten times. However, the approach looks good but it triggers queries multiple times.</p><h3>How to overcome this issue?</h3><p>Here I share chunks of code for better understanding.</p><p>This is a Service provider where bind the composer method. here use wild card * to bind variables in all views.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*slOJYhxa0SPTegT_OgcwIQ.png" /></figure><p>This is the method that is used to fetch data. when we @include any blade in the page at that time It triggers this method and it runs all queries under this method. we need to overcome this issue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*fbj4wr8UOaOJgcXyC_RU7w.png" /></figure><p>Here for reduce, this issue config can help us. When Compose method calls the first time set config so it will available every time.<br>And on every call need to check the config available or not based on these call queries. For that above code improvise as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*_Ug5vw4kEDvpVkYjWJVueQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2e429db3b003" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel HTML Minifier Package]]></title>
            <link>https://dipeshsukhia.medium.com/laravel-html-minifier-package-dfeb8dbd5a82?source=rss-22de94e76319------2</link>
            <guid isPermaLink="false">https://medium.com/p/dfeb8dbd5a82</guid>
            <category><![CDATA[laravel-development]]></category>
            <category><![CDATA[php-developers]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[minify]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Dipesh Sukhia]]></dc:creator>
            <pubDate>Tue, 28 Jul 2020 07:05:38 GMT</pubDate>
            <atom:updated>2020-07-28T07:05:38.730Z</atom:updated>
            <content:encoded><![CDATA[<p>Minification is the process of minimizing code and markup in your web pages and script files.</p><p>It’s one of the main methods used to reduce load times and bandwidth usage on websites.</p><p>Minification dramatically improves site speed and accessibility, directly translating into a better user experience.</p><p>Minification is a common strategy used to reduce the size of source code files by removing any unnecessary characters. It is very common with JavaScript and CSS files and goes a long way in improving the performance of your website.</p><p>Minification is less common in html files, but the strategy still applies.<br>for css and js we can use <a href="https://laravel.com/docs/7.x/mix">Compiling Assets (Mix)</a> in Laravel.</p><p>Here I introduce <a href="https://github.com/dipeshsukhia/laravel-html-minify">Laravel HTML Minifier</a> which can help us to minify html via following simple few steps.</p><h3>Github</h3><p><a href="https://github.com/dipeshsukhia/laravel-html-minify">dipeshsukhia/laravel-html-minify</a></p><h3>Installation</h3><pre>composer require dipeshsukhia/laravel-html-minify</pre><h3>Usage</h3><pre>php artisan vendor:publish --tag=LaravelHtmlMinify<br><br>you should add middleware to your web middleware group within your app/Http/Kernel.php file:<br>&#39;LaravelMinifyHtml&#39;<br><br>add in env<br>for enable<br>HTML_MINIFY = true<br>for disable<br>HTML_MINIFY = false</pre><p>Here need to add env variable <strong>HTML_MINIFY</strong> in .env file.<br>For enable/disable html minify output you can use this env variable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dfeb8dbd5a82" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel Countries States and Cities Data provider Package]]></title>
            <link>https://dipeshsukhia.medium.com/laravel-countries-states-and-cities-data-provider-package-668b3c71b92f?source=rss-22de94e76319------2</link>
            <guid isPermaLink="false">https://medium.com/p/668b3c71b92f</guid>
            <category><![CDATA[laravel-eloquent]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[country]]></category>
            <category><![CDATA[laravel-development]]></category>
            <category><![CDATA[laravel-6]]></category>
            <dc:creator><![CDATA[Dipesh Sukhia]]></dc:creator>
            <pubDate>Mon, 27 Jul 2020 13:35:57 GMT</pubDate>
            <atom:updated>2022-07-19T12:17:30.215Z</atom:updated>
            <content:encoded><![CDATA[<p>I recently launched a new package that gives you a powerful setup for dealing with the different Countries, States and Cities of the world, all through a comfortable Laravel syntax using Eloquent.</p><p>The package does a lot. As I was reviewing it I tried to think of some common use cases that almost every app needs and it is one of them.</p><p>This package gives all countries states cities data in form of <a href="https://laravel.com/docs/7.x/seeding">seeder </a>and also provide models so everyone can use it based on there project requirement it will take few minutes for integration.</p><h3>Github</h3><p><a href="https://github.com/dipeshsukhia/laravel-country-state-city-data">https://github.com/dipeshsukhia/laravel-country-state-city-data</a></p><h3>Installation</h3><pre>composer require dipeshsukhia/laravel-country-state-city-data --dev</pre><h3>Usage</h3><pre>run below commands<br>1) php artisan vendor:publish --tag=LaravelCountryStateCityData<br>2) composer dump-autoload<br>3) php artisan migrate</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=668b3c71b92f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>