<?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 Shashika Lakshitha on Medium]]></title>
        <description><![CDATA[Stories by Shashika Lakshitha on Medium]]></description>
        <link>https://medium.com/@devshashika?source=rss-7cdfb89f8a03------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_eJKDaCVA78gWaKSL7oRvg.png</url>
            <title>Stories by Shashika Lakshitha on Medium</title>
            <link>https://medium.com/@devshashika?source=rss-7cdfb89f8a03------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 13:46:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@devshashika/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[Why Your Resume Gets Rejected (and How to Make It ATS-Friendly)]]></title>
            <link>https://medium.com/@devshashika/why-your-resume-gets-rejected-and-how-to-make-it-ats-friendly-ad83421074a0?source=rss-7cdfb89f8a03------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad83421074a0</guid>
            <category><![CDATA[ats-friendly-resume]]></category>
            <category><![CDATA[professional-resume]]></category>
            <category><![CDATA[cv-writing]]></category>
            <category><![CDATA[resume-optimization]]></category>
            <category><![CDATA[resume-writing-tips]]></category>
            <dc:creator><![CDATA[Shashika Lakshitha]]></dc:creator>
            <pubDate>Thu, 01 Jan 2026 03:23:49 GMT</pubDate>
            <atom:updated>2026-01-01T03:23:49.725Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2uvFhTgTrGAzTeCN6E8b6A.png" /></figure><h3>How to Create an ATS-Friendly Resume That Gets You Noticed</h3><h3>Introduction</h3><p>Most firms today utilize the Applicant Tracking Systems (ATS) to screen resumes, even before human beings see the resumes. When your resume is not ATS friendly it is possible that it gets automatically rejected such that you are rejected regardless of being highly qualified. This article will discuss the meaning of an ATS, how it works, and some things you can start doing in order to pass the scan by your resume.</p><h3>What is an ATS and Why Does It Matter?</h3><p>Definition An ATS is a set of software that is used to gather, scan, and rank resumes by recruiters.</p><p>Native: It searches the keywords, abilities, job titles and formats that fit job description.</p><p>Impact: At least 90 percent of the fortune 500 companies utilize an ATS. A resume is not optimized and thus you might never make it to the interview level.</p><h3>Key Elements of an ATS-Friendly Resume</h3><h3>1. Use Standard Formatting</h3><ul><li>Stick to simple layouts (no tables, text boxes, or graphics).</li><li>Use clear headings like Education, Work Experience, Skills.</li><li>Save as <strong>.docx</strong> or <strong>PDF (text-based)</strong> — avoid scanned images.</li></ul><h3>2. Choose ATS-Friendly Fonts</h3><ul><li>Safe fonts: Arial, Calibri, Times New Roman, Verdana.</li><li>Avoid decorative or script fonts.</li></ul><h3>3. Optimize Keywords</h3><ul><li>Carefully read the job description.</li><li>Use keywords naturally in your work experience and skills section.</li><li>Example: If the JD says “REST APIs, Docker, AWS”, include those terms where relevant.</li></ul><h3>4. Highlight Core Skills Clearly</h3><ul><li>Use a <strong>Skills</strong> section with grouped categories:</li><li>Languages: PHP, JavaScript</li><li>Frameworks: Laravel, React, Bootstrap</li><li>Tools: Git, Docker, Jira</li></ul><h3>5. Focus on Achievements, Not Just Duties</h3><ul><li>Instead of “Responsible for developing APIs”, write “Developed 10+ REST APIs, reducing system response time by 25%.”</li></ul><h3>6. Avoid ATS Blockers</h3><ul><li><strong>No images, logos, or fancy designs.</strong> If you really want to keep a profile photo, you can Instead, add your <strong>LinkedIn profile link</strong> under the contact section. That way, recruiters can see your professional headshot there, and you don’t need to include a photo in the resume itself.</li><li><strong>Don’t use uncommon abbreviations.</strong> For example, write “Search Engine Optimization (SEO)” once before using just SEO.</li></ul><h3>Pro Tips for Higher ATS Scores</h3><ul><li>Keep your professional summary short and keyword-rich.</li><li>Skip the profile photo for ATS resumes. Instead, keep your LinkedIn updated with a professional headshot. Recruiters often check LinkedIn after the ATS shortlists you.</li><li>Test your resume using free ATS checkers (like Jobscan, ResumeWorded, or SkillSyncer…).</li></ul><h3>Resume expectations</h3><p>Resume expectations differ between regions, so it’s important to adapt to local norms while still keeping your CV ATS-friendly. Always check the local norm and the specific employer’s requirements.(In some regions, resumes should not include a photo or personal details, while in others it is common to include a profile photo, date of birth, or nationality.)</p><h3>Conclusion</h3><p>An ATS-friendly resume isn’t about design — it’s about clarity, keywords, and adaptability. By following these steps and tailoring to regional norms, you’ll increase your chances of passing the scan and landing that interview.</p><p><strong>Good luck, and may your ATS-friendly resume be the key to your next opportunity!<br>HAPPY NEW YEAR 2026, WISHING SUCCESS IN ALL YOUR PLANS. STAY FOCUSED ON THE MISSION</strong> 🥂</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad83421074a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel Broadcasting Explained]]></title>
            <link>https://medium.com/@devshashika/laravel-broadcasting-explained-48a4fd27efd7?source=rss-7cdfb89f8a03------2</link>
            <guid isPermaLink="false">https://medium.com/p/48a4fd27efd7</guid>
            <category><![CDATA[websocket]]></category>
            <category><![CDATA[laravel-broadcasting]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[realtime-applications]]></category>
            <dc:creator><![CDATA[Shashika Lakshitha]]></dc:creator>
            <pubDate>Tue, 28 Oct 2025 19:31:51 GMT</pubDate>
            <atom:updated>2025-10-28T19:31:51.753Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>How Laravel Broadcasting Works</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qg79EREWrHcc7ossOosO6A.png" /></figure><h3>Introduction</h3><p>Have you ever been curious how chat apps, dashboards, or notifications update instantly without refreshing the page? That’s where Laravel broadcasting is used.</p><p>In this article, I’ll walk you through what Laravel Broadcasting is, how it works behind the scenes, and when to use it, with real-world examples such as chat systems, dashboards, and delivery tracking.</p><h3>What Is Laravel Broadcasting?</h3><p>Laravel Broadcasting is the real-time communication layer of Laravel. It helps to push data from the backend to the frontend without refreshing the page or manual polling.</p><p>If you’ve ever tuned into a radio station, you already understand Laravel Broadcasting. When a radio station goes live, it broadcasts a signal on a specific frequency. Anyone who tunes in to that frequency can hear the broadcast, but only if they’re on the right channel. Laravel Broadcasting works the same way.</p><p><strong>Laravel Broadcast Flow</strong></p><p>1. An event occurs in your backend (e.g., new message, delivery update).</p><p>2. The event implements ShouldBroadcast.</p><p>3. Laravel pushes this event through a broadcast driver (Pusher, Laravel WebSockets, etc.).</p><p>4. The frontend listens for it using Laravel Echo.</p><p>5. When the event is received, the UI updates instantly without reloading.</p><p>Example:-</p><pre>1.create event<br><br>php artisan make:event OrderShipped<br><br><br>2.Implement ShouldBroadcast <br><br><br>use Illuminate\Contracts\Broadcasting\ShouldBroadcast;<br><br>class OrderShipped implements ShouldBroadcast<br>{<br>    public $order;<br><br>    public function __construct($order)<br>    {<br>        $this-&gt;order = $order;<br>    }<br><br>    public function broadcastOn()<br>    {<br>        return [&#39;orders&#39;];<br>    }<br><br>    public function broadcastAs()<br>    {<br>        return &#39;OrderShipped&#39;;<br>    }<br>}<br><br><br>3.Fire the Event<br><br>event(new OrderShipped($order));<br><br><br>4.Listen on the Frontend (its based on whether you are using plain JS, Vue, React) <br><br>import Echo from &quot;laravel-echo&quot;;<br><br>window.Echo.channel(&#39;orders&#39;)<br>    .listen(&#39;OrderShipped&#39;, (e) =&gt; {<br>        console.log(&#39;New Order Shipped:&#39;, e.order);<br>    });</pre><blockquote>Real Time Use Case</blockquote><p>1. Real-time notification</p><p>2. Chat Application.</p><p>3. Live Dashboard</p><p>4. Delivery Tracking</p><blockquote><strong>Available Drivers</strong></blockquote><p>Pusher — Cloud service for real-time messaging</p><p>Ably — Managed real-time platform</p><p>Redis — Self-hosted alternative</p><p>Laravel-websockets — Free, self-hosted WebSocket server</p><p>Log — for debugging</p><blockquote>Configure Your Driver .env</blockquote><pre>BROADCAST_DRIVER=pusher</pre><blockquote>Channel types:</blockquote><p>Public — Anyone can listen (like a news feed)</p><p>Private— Only authenticated users</p><p>Presence — Tracks who’s online</p><h3><strong>Conclusion</strong></h3><p>Laravel Broadcasting turns static applications into <strong>real-time experiences</strong>. Once you understand the event flow, you can apply it everywhere, notifications, chat, dashboards, delivery tracking, or alerts. If you haven’t tried it yet, start small broadcast a simple notification and open two browser tabs. That “instant update” moment will change how you see Laravel forever.</p><p>Code. Learn. Grow. Live.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48a4fd27efd7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Recent NPM Attack: What Every Developer Needs to Know]]></title>
            <link>https://medium.com/@devshashika/the-recent-npm-attack-what-every-developer-needs-to-know-7e5c44ff43b5?source=rss-7cdfb89f8a03------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e5c44ff43b5</guid>
            <category><![CDATA[developer-best-practices]]></category>
            <category><![CDATA[npm]]></category>
            <category><![CDATA[npm-attack]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[supply-chain-security]]></category>
            <dc:creator><![CDATA[Shashika Lakshitha]]></dc:creator>
            <pubDate>Tue, 23 Sep 2025 22:32:03 GMT</pubDate>
            <atom:updated>2025-09-23T22:32:03.660Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T1Lpo1FnFU2fjlJALi_GJA.png" /></figure><p>If you’re a JavaScript or Node.js developer, chances are you pulled code from npm this week. But what if the package you installed wasn’t safe? Recently, the open-source ecosystem was shaken by a major npm attack, which reminds us once again that the supply chain security of software cannot be optional.</p><p>We will analyze what happened, the impact it has had on developers all across the world, and, most importantly, what you can do to guarantee that your projects are not compromised</p><h3>What Happened in the Attack</h3><p>The attack proceeded by the malicious code being published in popular npm packages. The affected packages, after being installed, tried to steal sensitive data out of the developer systems as well as production environments.</p><p>There were also hijacked packages through compromised maintainer accounts and it also looked like typo-squatting (appearing similar packages in order to deceive the developer into installing the wrong package).</p><p>It is not the first attack on npm but the extent of this attack and the rate at which this occurred portray how easily the ecosystem can be compromised.</p><h3>Impact on Developers &amp; Companies</h3><p>Millions use the npm registry to drive applications in financial uses, e-commerce, logistics, and others. It does not take long before a single infected dependency spreads to the supply chain.</p><p>The risks included:</p><ul><li>The environment variables (API keys, database credentials, tokens) theft.</li><li>Insertion of malware or back doors.</li><li>There is a possibility of compromising CI/CD pipelines and production servers.</li></ul><p>Even those developers who installed the malicious packages locally and would immediately copy them to the local disk also risked leaking credentials without knowing it. To businesses, it would translate into violated customer information, loss of money, and destruction of reputation.</p><h3>How the Attack Worked</h3><p>The attack was technically based on the malicious scripts being injected into npm packages. These scripts were run when they were installed as lifecycle hooks (preinstall or postinstall).</p><p>After being triggered the malicious code tried to:</p><ul><li>Send the organization environment to an attacker-owned server.</li><li>Now, intercept system data to be used further.</li><li>In others, execute extra malware loads.</li></ul><p>The exploit’s simplicity serves as a reminder that the underlying vulnerability is not a complicated zero-day vulnerability, but our naïve confidence in third-party packages.</p><h3>Lessons for Developers</h3><p>Once again, some important lessons are reinforced in this incident:</p><ul><li><strong>Trust but verify</strong> — Because a package is popular it does not mean it is safe.</li><li><strong>Open source is not risk-free — </strong>The risk has no boundary. Anyone can put a package on freedom, and maintainers themselves are not immune to attack.</li><li><strong>Supply chain attacks are on the increase</strong> — Since SolarWinds to Log4Shell to npm, attackers are aware that the weakest access area is often where you sit on the dependencies.</li></ul><h3>Security Best Practices (Checklist)</h3><p>I simply want to know how to safeguard as much as possible. Here are some ways you can defend yourself and your team</p><ol><li><strong>Pin dependency versions</strong> — Always commit your package-lock.json or use npm shrinkwrap.</li><li><strong>Run audits regularly</strong> — Use npm audit, Snyk, or GitHub Dependabot.</li><li><strong>Enable 2FA for npm accounts</strong> — Especially if you maintain packages.</li><li><strong>Avoid unnecessary packages</strong> — Each dependency is a new attack surface.</li><li><strong>Review maintainers</strong> — Check if a package has suspicious maintainers or sudden changes.</li><li><strong>Monitor advisories</strong> — Stay updated with security bulletins from npm and GitHub.</li></ol><p>⚡ (This reminds a piece of dialogue from the movie “ <strong>First:- no system is safe</strong>. Second-…. Third — …..” )</p><h3>Conclusion</h3><p>The recent npm attack is a wake-up call. Open source remains the backbone of modern development, but it’s also a target-rich environment for attackers.</p><p>👉 As developers, we can’t control every package on the internet, but we can control how carefully we manage and secure our dependencies. The question isn’t if another attack will happen……it’s when.</p><p>✨ If you found this article useful, share it with your team or network. The stronger our developer community’s security awareness, the harder it becomes for attackers to succeed. Good luck, all Devs!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e5c44ff43b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PHP Return Types Explained: function(): array vs function()]]></title>
            <link>https://medium.com/@devshashika/php-return-types-explained-function-array-vs-function-4dfd9a1774d4?source=rss-7cdfb89f8a03------2</link>
            <guid isPermaLink="false">https://medium.com/p/4dfd9a1774d4</guid>
            <category><![CDATA[flexibility]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[return-type]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[function]]></category>
            <dc:creator><![CDATA[Shashika Lakshitha]]></dc:creator>
            <pubDate>Sat, 16 Aug 2025 04:53:22 GMT</pubDate>
            <atom:updated>2025-08-16T04:53:22.986Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RATccbBRPS_hNOTPbQ3NUg.png" /><figcaption>PHP Return Type Declarations</figcaption></figure><p>As PHP developers, we often write functions that return data like strings, objects, or arrays. But how we define those return values can make a huge difference in code quality, safety, and maintainability.</p><p>PHP introduced return type declarations in version 7.0, and expanded support with</p><ul><li><strong>Union types</strong> (PHP 8.0)</li><li><strong>Mixed</strong>, <strong>never</strong></li><li><strong>Intersection types</strong> (PHP 8.2)</li></ul><p>In this article, we will discuss,</p><ul><li>The main difference between the two popular signatures of PHP functions</li><li>Commonly used return types</li><li>When and why to use return type declarations</li></ul><h3><strong>What are the return types of a declaration?</strong></h3><p>Since PHP 7, a programmer may also specify (optionally) the type of the value returned by a function declaration. Such a declaration mechanism allows the PHP runtime environment to ensure that the given function really returns a value of the declared type.</p><pre>public function getItems(): array{<br>   return [&#39;apple&#39;, &#39;banana&#39;];<br>}</pre><p>This function guarantees that it <strong>will always return an array</strong>, and if it doesn’t, PHP will throw an error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*boK-zCcG4hGnQmHmIarAMg.png" /></figure><p><strong>Without Return Type</strong></p><pre>public function getData(){<br>    if(rand(0,1)){<br>      return [&#39;a&#39;, &#39;b&#39;, &#39;c&#39;];<br>    }<br> return &#39;Oops!&#39;; <br>}</pre><p><strong>With the return type</strong></p><pre>public function getData(): array{<br>  return [&#39;a&#39;, &#39;b&#39;, &#39;c&#39;];<br>}</pre><p>But if you do like this,</p><pre>public function getData(): array{<br>  return &#39;Oops!&#39;; <br>}</pre><p>PHP will throw a TypeError at runtime because the return value is not an array.</p><p><strong>Additional Note :</strong></p><p>Basic Types</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*bTAJn88klb-XK6uL-PITOQ.png" /></figure><p>Compound types</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*z7edHKPCMqV0A0Iev8w4Tg.png" /></figure><p><strong>Class or Interface Types</strong></p><pre>public function getUser(): User{<br>  return new User();<br>}</pre><p><strong>self, parent, static (PHP 8.0+)</strong></p><ul><li>self → return an instance of the same class.</li><li>parent → return from the parent class.</li><li>static → late static binding.</li></ul><h4><strong>Nullable and Union Return Types</strong></h4><p>PHP also supports <strong>nullable</strong> and <strong>union</strong> return types for added flexibility.</p><p><strong>Nullbale Array</strong></p><pre>public function getData(): ?array{<br>  return null;<br>}</pre><p><strong>Union Types (PHP 8.0+) </strong><br>Allow multiple possible types:</p><pre>public function getData(): array|string{<br>  return &#39;Fallback&#39;;<br>}</pre><p><strong>Intersection Types (PHP 8.2+)</strong></p><p>Used when a return type must satisfy multiple interfaces:</p><pre>public function getLogger(): LoggerInterface&amp;AuditableInterface</pre><p><strong>void and never</strong></p><ul><li>void → Must not return anything:</li></ul><pre>public function logMessage(): void{<br>  echo &#39;Logged&#39;;<br>}</pre><ul><li>never (PHP 8.1+) → Function never returns, e.g., throws an exception or exits</li></ul><pre>public function terminate(): never{<br>  exit();<br>}</pre><h4><strong>Conclusion</strong></h4><p>When there is no return type in code, this increases the flexibility, but at the same time, it can create unknown bugs and unexpected results. In comparison, the enforced tough form of return has ensured reliability, coherence, and robustness, especially in the realm of bigger systems. But remember to add flexibility when truly needed.</p><p>Have return types saved you from a bug? Or do you still prefer the freedom of loose typing? Let me know in the comments! 👇 . Happy coding! 👨‍💻👩‍💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4dfd9a1774d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[php.ini Best Practices: How to Configure php.ini Like a Pro]]></title>
            <link>https://medium.com/@devshashika/php-ini-best-practices-how-to-configure-php-ini-like-a-pro-bcd81355bd4b?source=rss-7cdfb89f8a03------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcd81355bd4b</guid>
            <category><![CDATA[php-developers]]></category>
            <category><![CDATA[php-security]]></category>
            <category><![CDATA[php-ini]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[php-development]]></category>
            <dc:creator><![CDATA[Shashika Lakshitha]]></dc:creator>
            <pubDate>Thu, 05 Jun 2025 14:38:05 GMT</pubDate>
            <atom:updated>2025-06-05T14:38:05.219Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PnpavuCFUaopge19UtewKw.png" /></figure><h3><strong>What is the PHP.ini file?</strong></h3><p>The default PHP configuration file is called php.ini. By defining different settings and instructions for PHP’s functionality, it controls how PHP acts. A PHP interpreter reads the php.ini file to check its configuration when it first starts.</p><h3><strong>Key features</strong></h3><p><strong>Global Settings:</strong></p><p>It sets global configurations for all PHP scripts running on the server, unless overridden at runtime or by .htaccess files (in case of Apache).</p><p><strong>Directive Configuration:</strong></p><p>It includes a wide range of directives, like error reporting levels, memory limits, session behavior, and file upload configurations.</p><p><strong>Customizability:</strong></p><p>You can tweak this file to optimize performance, enforce security measures, or suit application-specific needs.</p><p><strong>File Location:</strong></p><p>The location of php.ini depends on the server setup. For example, in MAMP, it might be in a folder like /Applications/MAMP/bin/php/phpX.X.X/conf/.</p><p><strong>Default vs. Customized:</strong></p><p>PHP ships with a default php.ini file, but developers often customize it for their specific environment.</p><h3><strong>How to protect or how to configure it properly.</strong></h3><ol><li><strong>Disable Dangerous Functions</strong></li></ol><p>Reducing the attack surface of your server is mostly dependent on restricting possibly harmful PHP operations. If taken advantage of, these capabilities can let attackers run system-level commands.</p><pre>disable_functions = exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source</pre><p>📍 Note</p><p><strong>A) Customize Based on Your Application Needs</strong></p><ul><li>Only disable functions that your application does not require. For instance, if your application uses curl_exec to make API requests, you should not disable it.</li><li>Test your application after making changes to ensure functionality isn’t broken.</li></ul><p><strong>B) Why are these functions risky</strong></p><ul><li><strong>exec, passthru, shell_exec, system</strong>: Execute shell commands directly.</li><li><strong>proc_open, popen</strong>: Spawn processes and interact with the system shell.</li><li><strong>curl_exec, curl_multi_exec</strong>: Can be abused for SSRF (Server-Side Request Forgery) if improperly validated.</li><li><strong>parse_ini_file, show_source</strong>: Can expose sensitive configuration details.</li></ul><p>C) <strong>Alternative Security Measures</strong></p><ul><li>Use robust input validation and sanitization to reduce the risk of exploits.</li><li>Consider using application-level APIs for specific tasks instead of relying on system commands.</li></ul><h4>2. Hide PHP Version</h4><p>By default, PHP exposes its version number in HTTP headers, such as X-Powered-By. This information can help attackers tailor their exploits to known vulnerabilities in specific PHP versions. Hiding the PHP version adds a layer of obscurity, making it harder for attackers to gather information about your server.</p><pre>expose_php = Off</pre><ul><li>When expose_php is set to Off, PHP stops sending the X-Powered-By header in HTTP responses.</li><li>This minimizes the information attackers can glean from server responses, reducing your application’s exposure to targeted attacks</li></ul><p>If you want to check, open your terminal and execute the following command:</p><pre>curl -I http://examplesite.com</pre><p>The -I option fetches only the HTTP headers, not the full response body.</p><p>Run the curl command again to confirm that the X-Powered-By header is gone.</p><h4>3. Disallow Remote File Inclusion</h4><p>Remote file inclusion (RFI) vulnerabilities occur when an attacker exploits the ability to include files from external servers, potentially executing malicious code on your server. To mitigate this risk, disable the inclusion of files via URLs.</p><pre>allow_url_include = Off</pre><ul><li>When allow_url_include is enabled, PHP allows files to be included via URL (e.g., include(“http://example.com/file.php&quot;);).</li><li>This can be exploited by attackers to include remote scripts, leading to unauthorized code execution or data breaches.</li></ul><p><strong>Why It’s Important:</strong></p><ul><li>RFI is one of the most common vulnerabilities exploited in PHP applications.</li><li>Disabling this feature ensures that only local files can be included, significantly reducing the attack surface.</li></ul><p><strong>Addtionally</strong></p><pre>allow_url_fopen = Off</pre><p>This prevents PHP from opening remote files, further limiting potential vulnerabilities.</p><p>Run the command below, then you can find out if allow_url_include is disabled:</p><pre>php -i | grep allow_url_include</pre><h4>4. Disable Error Display</h4><p>Exposing error messages in a production environment can inadvertently provide attackers with valuable information about your application’s structure, configuration, or vulnerabilities. Instead, errors should be logged for debugging purposes without being displayed to users.</p><pre>display_errors = Off<br><br>log_errors = On<br><br>error_log = /path/to/php_error.log</pre><p><strong>Explanation:</strong></p><pre>display_errors = Off:</pre><ul><li>Prevents PHP from displaying error messages to the end user.</li><li>Errors in production should be hidden to avoid exposing sensitive information like file paths, configuration details, or database queries.</li></ul><pre>log_errors = On:</pre><ul><li>Ensures that errors are logged instead of displayed. These logs can then be reviewed by developers for debugging and monitoring.</li></ul><p><strong>error_log:</strong></p><ul><li>Specifies the file where PHP should log errors. Make sure the log file is located in a directory not accessible to the public.</li></ul><h4>Why It’s Important:</h4><ol><li>Information Leakage: Exposed error messages might reveal:</li></ol><ul><li>Absolute file paths.</li><li>SQL queries and database details.</li><li>Server or framework configurations.</li></ul><h4>5. Harden Session Cookies</h4><p>PHP session cookies store sensitive data to maintain user state. Misconfigured session handling can expose your application to security risks such as XSS (Cross-Site Scripting), CSRF (Cross-Site Request Forgery), and session fixation attacks. Strengthening session cookie settings is essential for secure session management.</p><pre>session.cookie_httponly = 1<br>session.cookie_secure = 1<br>session.cookie_samesite = Strict<br>session.use_strict_mode = 1</pre><h4>Explanation of Each Setting</h4><ol><li><strong>session.cookie_httponly = 1</strong>:</li></ol><ul><li>Ensures that session cookies are inaccessible via JavaScript.</li><li>Protects against XSS attacks where attackers might attempt to steal session cookies using malicious scripts.</li></ul><p><strong>2. session.cookie_secure = 1</strong>:</p><ul><li>Forces session cookies to be transmitted only over HTTPS.</li><li>Prevents interception of cookies during transmission (e.g., via man-in-the-middle attacks).</li></ul><p>3. <strong>session.cookie_samesite = Strict</strong>:</p><ul><li>Prevents the session cookie from being sent with cross-origin requests.</li><li>Protects against CSRF attacks by ensuring cookies are only sent in same-site contexts.</li></ul><p><strong>4. session.use_strict_mode = 1</strong>:</p><ul><li>Enforces strict mode for session handling, preventing session fixation attacks.</li><li>Ensures that only cookies with valid session IDs are accepted.</li></ul><p><strong>Why is it important ?</strong></p><p>Prevention of Common Attacks:</p><ul><li>Reduces the risk of session hijacking, fixation, XSS, and CSRF.</li></ul><h4>6. Disable File Uploads (If Not Needed)</h4><p>File uploads are a common attack vector, especially when file validation and sanitization are improperly implemented. If your application does not require file uploads, disabling this functionality altogether eliminates a significant attack surface.</p><p>file_uploads = Off</p><h4>Why Disable File Uploads?</h4><ol><li><strong>Reduce Attack Surface</strong>:</li></ol><p>Prevent attackers from uploading malicious files (e.g., scripts, executables) that can be executed on your server.</p><p>2. <strong>Simplicity</strong>:</p><ul><li>If your application does not use file uploads, there’s no reason to leave the functionality enabled.</li></ul><p><strong>What If File Uploads Are Necessary?</strong></p><p>If your application requires file uploads, consider these security best practices:</p><ol><li><strong>Restrict Upload Types</strong>:</li></ol><p>Only allow specific file types (e.g., .jpg, .png, .pdf).</p><ol><li><strong>Set Upload Limits</strong>:</li></ol><pre> upload_max_filesize = 2M<br> post_max_size = 3M</pre><p><strong>3. Sanitize File Names</strong>:</p><ul><li>Remove special characters and validate file names to prevent path traversal attacks.</li></ul><p><strong>4. Store Files Outside the Web Root</strong>:</p><ul><li>Store uploaded files in a directory that is not directly accessible via the web.</li></ul><p><strong>Keep in mind, these </strong><strong>php.ini settings aren’t one-size-fits-all—adjust them thoughtfully based on what your project truly needs to stay secure and functional.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcd81355bd4b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding and Preventing XSS Attacks in Laravel Applications]]></title>
            <link>https://medium.com/@devshashika/how-to-understand-and-prevent-xss-attacks-in-laravel-applications-5c4cca59de58?source=rss-7cdfb89f8a03------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c4cca59de58</guid>
            <dc:creator><![CDATA[Shashika Lakshitha]]></dc:creator>
            <pubDate>Sun, 04 May 2025 18:01:32 GMT</pubDate>
            <atom:updated>2025-05-22T14:37:59.906Z</atom:updated>
            <content:encoded><![CDATA[<h3>Laravel Security: How To Prevent XSS Attacks in Laravel Applications</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Ka1o_YHyCT2bcn0C" /></figure><p>One frequent security flaw is cross-site scripting (XSS). This security flaw lets malicious users inject harmful client-side scripts that affect other people viewing the compromised pageTo help defend against XSS attacks, the Laravel framework comes with a number of built-in options.</p><h4><strong>Blade Template Engine.</strong></h4><p>When we use double curly braces {{ }} to output data, Blade will automatically escape any HTML entities. This is a blade engine feature</p><pre>// This will automatically escape HTML entities<br>&lt;p&gt;{{ $output }}&lt;/p&gt;<br>//If you need to output raw HTML,This will output raw HTML <br>&lt;p&gt;{!! $output !!}&lt;/p&gt;</pre><p>&lt;p&gt;{{ $output }}&lt;/p&gt;</p><h4><strong>Use Laravel’s strip_tags() or htmlspecialchars() for Cleaning Input</strong></h4><p>Make sure the content is sanitized. More details in my previous article about sanitization.</p><p>Use <strong>strip_tags() </strong>to remove HTML and PHP tags from a string</p><pre>$sanitizedInput = strip_tags($input);</pre><p>Use <strong>htmlspecialchars() </strong>to convert special characters to HTML entities, preventing XSS:</p><pre>$sanitizedInput = htmlspecialchars($input, ENT_QUOTES, &#39;UTF-8&#39;);</pre><p><strong>You can do middleware for sanitization, This may not be suitable for every circumstance.</strong></p><ul><li>Reducing code duplication helps to code more cleanly and maintainably.</li><li>If we need to allow some HTML tags, we can easily modify them inside the middleware.(ex: WYSIWYG editor)</li><li>Instead of sanitizing input manually in every controller, middleware applies sanitization automatically to all requests.</li></ul><h4><strong>Laravel’s Purifier Package</strong></h4><p>Laravel doesn’t have a built-in HTML purifier, but you can use the mews/purifier package to sanitize HTML content. This package can remove malicious code from HTML input.</p><p>Install the package via Composer:</p><pre>composer require mews/purifier</pre><p>You can use it…</p><pre>use Mews\Purifier\Facades\Purifier;<br><br>$cleanHtml = Purifier::clean($userInput);</pre><h4><strong>Can we use Content Security Policy (CSP) to prevent XSS Attacks ?</strong></h4><p>Yes, you can and generally should use CSP (Content Security Policy) for every Laravel project. This implements an additional safeguard to help prevent XSS attacks on your web application. However, it may not be practical sometimes. It depends on your specific requirements and the complexity of your application.</p><p><strong>Benefits</strong></p><ul><li>Protects against XSS, clickjacking, and other code injection attacks</li><li>We can define exactly what resources can be loaded</li></ul><p><strong>Practical Considerations</strong></p><ul><li>For simple applications with known, controlled resources</li><li>When you’re not relying on many third-party scripts/styles</li><li>For APIs (where CSP headers can be simpler)</li></ul><h4>Conclusion</h4><p>Laravel offers robust options for preventing XSS attacks, from the Blade template engine to external packages like Mews Purifier. By combining input sanitization, automatic escaping, and CSP, you can create a secure environment for your Laravel applications.</p><p>While these strategies are effective, always tailor your approach to your project’s specific needs and complexity. Security is an ongoing process — stay vigilant and keep your applications safe…</p><p>&lt;! — This will output raw HTML →</p><p>&lt;p&gt;{!! $output !!}&lt;/p&gt;</p><p>However, be careful when you use {!! !!} . It can expose your application to XSS. You have to make sure the content is properly sanitized.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c4cca59de58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel Security: Laravel Input Validation and Data Sanitization]]></title>
            <link>https://medium.com/@devshashika/laravel-security-laravel-input-validation-and-data-sanitization-202262c56037?source=rss-7cdfb89f8a03------2</link>
            <guid isPermaLink="false">https://medium.com/p/202262c56037</guid>
            <dc:creator><![CDATA[Shashika Lakshitha]]></dc:creator>
            <pubDate>Thu, 13 Mar 2025 11:55:55 GMT</pubDate>
            <atom:updated>2025-03-13T11:55:55.853Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y-Wvqy0sUHTjYt08Wl1HGQ.png" /></figure><p>Input validation makes sure that user data is properly sanitized and verified to the expected format before being processed. It helps prevent attacks such as SQL Injection and reduces the risk of application errors.</p><p><strong>Implementation:</strong></p><p>Validate inputs on the server without depending on client-side validation.</p><p>Use Laravel’s built-in validation rules.</p><pre>public function store(Request $request)<br>{<br>    // Validate the request<br>    $validatedData = $request-&gt;validate([<br>        &#39;name&#39; =&gt; &#39;required|string|max:255&#39;,<br>        &#39;email&#39; =&gt; &#39;required|email|unique:users,email&#39;,<br>        &#39;password&#39; =&gt; &#39;required|string|min:8|confirmed&#39;,<br>    ]);<br><br>    // If validation passes, start the proceed with storing the data<br>    <br>}</pre><ul><li>required: The field must be present.</li><li>string: The field must be a string.</li><li>max:255: The field must not exceed 255 characters.</li><li>email: The field must be a valid email address.</li><li>unique: users, email: The email must be unique in the users table.</li><li>min:8: The password must be at least 8 characters long.</li><li>confirmed: The field must have a matching field_confirmation (e.g., password_confirmation)</li></ul><p><strong>More details</strong>: <a href="https://laravel.com/docs/11.x/validation">https://laravel.com/docs/11.x/validation</a></p><h3><strong>Sanitization</strong></h3><p>Sanitization helps to remove any unwanted characters or scripts.</p><pre>$sanitizedInput = filter_var($input, FILTER_SANITIZE_STRING);</pre><p>Use strip_tags() to remove HTML and PHP tags from a string</p><pre>$sanitizedInput = strip_tags($input);</pre><p>Use htmlspecialchars() to convert special characters to HTML entities, preventing XSS:</p><pre>$sanitizedInput = htmlspecialchars($input, ENT_QUOTES, &#39;UTF-8&#39;);</pre><ul><li>PHP 7.2 and earlier: You can use FILTER_SANITIZE_STRING.</li><li>PHP 7.3–8.0: Deprecated but still functional; recommended to switch to alternatives.</li><li>PHP 8.1 and later: Use alternatives like strip_tags() or htmlspecialchars().</li></ul><h3><strong>Conclusion</strong></h3><p>By using Laravel’s built-in features and the best practices mentioned above, you can significantly reduce the risk. This focuses only on sanitization. there are additional steps to take as well.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=202262c56037" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Monolithic vs Microservices: Which Architecture Should You Choose and When?]]></title>
            <link>https://medium.com/@devshashika/monolithic-vs-microservices-which-architecture-should-you-choose-and-when-d027c3cd5f36?source=rss-7cdfb89f8a03------2</link>
            <guid isPermaLink="false">https://medium.com/p/d027c3cd5f36</guid>
            <dc:creator><![CDATA[Shashika Lakshitha]]></dc:creator>
            <pubDate>Sun, 02 Mar 2025 10:47:11 GMT</pubDate>
            <atom:updated>2025-03-02T10:47:11.108Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hyhbQePksnfvxVC6F9UsAA.png" /></figure><p>One of the most crucial decisions you will have to make when creating a new application is selecting the right architecture. The question is “Which is preferable, a monolithic or a microservice ?” Both offer benefits and drawbacks, and the choice depends on the project’s size, complexity, and long-term goals.</p><h3><strong>What is the monolithic architecture?</strong></h3><p>Monolithic architecture is like a single unit or It is like an all-in-one package. All the components of your application’s front-end user interfaces, back-end logic, database interaction, and business logic are bundled together into one codebase. This application is developed, deployed, and scaled as a single entity.</p><h4><strong>Advantages of Monolithic Architecture</strong></h4><ul><li><strong>Simplicity in Development: </strong>In this architecture, everything is in one place, and it is easier to write, test, and debug the code.</li><li><strong>Easy Deployment: </strong>When deploying, you only have one application to deploy. You need to manage one CI/CD pipeline.</li><li><strong>Better Performance: </strong>No need for network calls between components, because all components run together. latency isn’t an issue.</li><li><strong>Ideal for Small Projects:</strong> If you’re building a small application, monolith is often the best choice.</li><li><strong>Easy to Debug: </strong>With a single application, debugging is easier when you only have to focus on one codebase and environment. Instead of handling several programs that need to run on separate ports.</li></ul><p><strong>Disadvantages of Monolithic Architecture</strong></p><ul><li><strong>Scalability Issues:</strong> If one area of the program has a high volume of traffic, you must scale the entire application, which can be highly expensive and wasteful.</li><li><strong>Complexity Over Time:</strong> As the application grows larger, the source code could become more messy and difficult to maintain.</li><li><strong>Release Process:</strong> Even small modifications need redeploying the whole application, It leads in to longer testing and release timeframes.</li><li><strong>System-Wide Failure Risk:</strong> A failure in a specific component of the application could lead to an impact on the whole system or application, which might lead to downtime.</li><li><strong>Limited Flexibility:</strong> when implementing new technologies and frameworks for individual areas of the application or system makes it harder, because all components are closely connected.</li></ul><h3><strong>What is microservice?</strong></h3><p>A microservice architecture divides the application into smaller, individual services(or components). Each service handles a specific business function (such as user authentication, payment processing, streaming, searching, and recommendation). Each service is self-contained and independent. They all have their own infrastructures and databases. Each microservice has its own application and version.</p><p>These services communicate with each other by using APIs(usually RESTful or GraphQL), message brokers, and Service Mesh.</p><p><strong>1. API Calls (Synchronous Communication)</strong></p><p>Each microservice has its own end-point that other microservices can call. It should be used when needing to synchronize communication between components. This method is ideal when you need immediate response or real-time interaction.</p><p>As an example before proceeding with the payment, a user service might call a Payment Service to process a payment and wait for a confirmation.</p><p>HTTP requests introduce latency to the application. This delay can impact the application’s performance. This delay can be reduced by using <strong>gRPC Compression</strong>. But not guaranteed in every scenario.</p><p><strong>2. Message Brokers. (Asynchronous Communication)</strong></p><p>A message broker is a piece of software or application that handles the transmission of messages across many microservices, allowing for asynchronous communication. Microservice indirectly communicates with the message broker. When a service sends a message to a queue, then another service picks it up and starts processing it. Asynchronous is sender doesn’t wait for a response.</p><p>Microservice indirectly communicates with the message broker. When a service sends a message to a queue, then another service picks it up and starts processing it. Asynchronous is sender doesn’t wait for a response.</p><p>This method is best suited for functions that don’t require quick responses, such as emailing, and other background functions.</p><p><strong>Examples of tools: RabbitMQ, Apache Kafka, AWS SQS.</strong></p><p><strong>3. Service Mesh (Advanced Communication).</strong></p><p>A service mesh is a specialized infrastructure layer that manages microservices’ communication. Controlling encryption, load balancing, retries, and service discovery, it helps to increase the security and dependability of communication.</p><p>This approach is suited for big, complex systems with lots of microservices that require sophisticated communication tools like circuit breakers, timeouts, and retries.</p><p><strong>Example: Service mesh tools are used in Kubernetes.</strong></p><p><strong>Advantages of Microservice Architecture</strong></p><ul><li><strong>Scalability: </strong>You can scale individual services according to requirements, which is less expensive than scaling a monolith.</li><li><strong>Independent Development:</strong> Teams can work on many services at the same time without interfering with each other’s work. This speeds up the development and deployment processes.</li><li><strong>Technology Flexibility:</strong> Each service can use a different technology stack.</li><li><strong>Faster Releases:</strong> When changes are for one service, it do not require redeploying the entire application.</li></ul><p><strong>Disadvantages of Microservice Architecture</strong></p><ul><li><strong>Increased Complexity: </strong>Sometimes It may become difficult to manage many services, CI/CD pipelines, and service communication.</li><li><strong>Debugging: </strong>Issues may impact several services, making it harder to figure out the core cause of a problem.</li><li><strong>Infrastructure Costs: </strong>For small applications, managing several services might be costly.</li><li><strong>Local Development: </strong>Running the full program locally can be difficult due to service requirements.</li></ul><p><strong>Conclusion:</strong></p><p>When choosing a suitable architecture between monolithic and microservice depends on your project’s requirements. Monoliths are most suitable for small or simple applications and If you’re just getting started, it’s typically perfect to begin with a monolith. Microservices are a better choice for large-scale, complex applications that require scalability, flexibility, and independent development. if you know your application getting millions of requests per day, it needs to handle high traffic from the beginning, in that case, microservices might be better the way to go(<strong>or at least semi-monolith</strong>).</p><p>Ultimately, the right choice depends on your specific use case, team size, and long-term goals.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d027c3cd5f36" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel Lazy Loading vs Eager Loading: Optimize Your Queries and Prevent N+1 Problems]]></title>
            <link>https://medium.com/@devshashika/laravel-lazy-loading-vs-eager-loading-optimize-your-queries-and-prevent-n-1-problems-028f60e0a812?source=rss-7cdfb89f8a03------2</link>
            <guid isPermaLink="false">https://medium.com/p/028f60e0a812</guid>
            <category><![CDATA[lazy-loading]]></category>
            <category><![CDATA[eager-loading]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[laravel-optimization]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Shashika Lakshitha]]></dc:creator>
            <pubDate>Mon, 17 Feb 2025 17:18:51 GMT</pubDate>
            <atom:updated>2025-02-17T17:18:51.002Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lfgqFkmguDmLKk38F2LFjw.png" /></figure><p>Lazy loading and Eager loading are two different strategies used to load the data from the database. They are used to optimize the performance of the Laravel application.</p><h3>Lazy Loading</h3><p>Lazy Loading is a technique where related data is loaded from the database only when it is accessed. This means that the related eloquent model’s data is not retrieved until the relationship is explicitly accessed in the code. Eloquent Relationships must be defined in the models for lazy loading to work. Eloquent relationships are defined as methods in your Eloquent model classes.</p><p><strong>How it works…</strong></p><p>When you query the main model, Laravel retrieves only the main data from the database. If you need related data, a separate query is executed when you access the relationship.</p><pre>$author = Author::find(10); // This fetches the specific author data.</pre><p>At of now, only the author’s data is fetched. If you want to fetch the books related to that author, you need to access the relationship which is defined in the model</p><p>Eloquent relationship example in Author.php — Model</p><pre>// Define the relationship an author has many books<br>public function books()<br>{<br>return $this-&gt;hasMany(Book::class);<br>}</pre><p>Access the relationship</p><pre><br> $books = $author-&gt;books; // new query to fetch the books for that author.</pre><p>When you retrieve a model, the related models are not loaded by default, only when the related relationship is accessed, the query is executed to fetch the related data.</p><p><strong>The N+1 Query Problem</strong></p><p>Lazy loading can lead to the N+1 query problem when you loop through multiple parent models and access their relationships.</p><p>Lazy loading is most suitable in scenarios where the related data is not always needed. Otherwise, it can lead to performance issues.</p><h3>Eager Loading</h3><p>Eager loading is a technique where related data models are loaded simultaneously with the main model. This means that when user data is fetched, the related user data is also retrieved in a single query.</p><h4>How it works…</h4><pre>$user = User::with(&#39;post&#39;)-&gt;find(10);</pre><p>Laravel provides eager loading using the<strong> with() </strong>method. This method loads related model data efficiently. This can reduce the number of executed queries. It helps improve performance and prevents the N+1 query problem.</p><p>This can increase the initial load time if too much-related data is loaded at once. It also consumes more memory.</p><p><strong>Conclusion</strong></p><p>However, both methods are necessary. When choosing between eager loading and lazy loading, consider the specific use case and the performance requirements of the web application.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=028f60e0a812" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>