{"id":3794,"date":"2019-06-19T13:01:02","date_gmt":"2019-06-19T13:01:02","guid":{"rendered":"https:\/\/infyblog.zluck.in\/?p=3794"},"modified":"2025-07-17T07:37:05","modified_gmt":"2025-07-17T07:37:05","slug":"laravel-app-code-optimizations-tips","status":"publish","type":"post","link":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/","title":{"rendered":"Laravel App &#8211; Code Optimizations Tips"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"3794\" class=\"elementor elementor-3794\" data-elementor-post-type=\"post\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-90c15a9 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"90c15a9\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-efa3aa5\" data-id=\"efa3aa5\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\n\t\t<div class=\"elementor-element elementor-element-0265255 elementor-widget elementor-widget-text-editor\" data-id=\"0265255\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Last month we started working on one of our internal project called <a href=\"https:\/\/labs.infyom.com\/infy-tracker\/\">InfyTracker<\/a>, which we were planning to use as a simple time tracker and very little of project management or task reporting.<\/p><p>We have also published it as an open source project to our <a href=\"https:\/\/github.com\/infyomlabs\">Github<\/a> account so other people from the community can use it. It&#8217;s still in alpha stage and we are still working on it and making tons of improvements. But, While building this project, we found a few things that we think might be useful to optimize the app or can be used in other projects. Also, I think lots of developers even do not realize these things.<\/p><p>So I planned to share it with the community where I will be discussing them in a detail with solutions we used. So here are the things\/mistakes that we found during our project development.<\/p><ol><li>Adding all stylesheets and scripts in a layout file<\/li><li>Not separating out page level CSS or JS<\/li><li>Not using laravel-mix<\/li><\/ol><h2>1. Adding all stylesheets and scripts in layout<\/h2><p>What I&#8217;ve seen is, when we want to add a new library\/package to the project, people generally go to the layout file and just insert a style and script tag there.<\/p><p>For e.g., I want to use moment-js in the app, so what I do, I go to my layout file and include moment-js script tag there via CDN. Even if I only need moment-js in few of my pages. same can be there for other libraries like datatables, even if we only need datatables in a few pages of the app.<\/p><p>The problem it creates is, even if we don&#8217;t need them in most of our pages, those files are still included in our page and of course, the page takes more time to load.<\/p><h2>2. Not separating out page level CSS or JS<\/h2><p>Generally, we use lots of JS in our code. And for all page level JS\/CSS, most of the developers put it in a blade file of the page at the bottom with some section of JS\/CSS.<\/p><p>For e.g, I have used a datatable in my page, so I need to initialize the datatable. so generally, I will have declared one section called scripts or bottom_js which will be yielded in my layout file. That&#8217;s what I have seen in lots of code.<\/p><p>But, there are two problems with that,<\/p><ol><li>When that page is loaded, your JS code is completely visible to the world and sometimes that&#8217;s not good and secure<\/li><li>It&#8217;s not minified (and since it&#8217;s sitting into your blade files, there is no way to minify it either)<\/li><\/ol><h2>3. Not using laravel-mix<\/h2><p>In really few projects or very few expert developers use laravel-mix or use laravel-mix in the right way. When you do not use laravel-mix in your site, your JS\/CSS files are not minified. It&#8217;s completely visible to the world which can be sometimes dangerous and file sizes are big as well in large projects.<\/p><p>That&#8217;s the three major things that we found while developing this project.<\/p><p>Here is the solution that we used to overcome these problems.<\/p><h2>Solution 1. Adding all stylesheets and scripts in specific pages<\/h2><p>To resolve this problem, we declared two sections in our layout file.<\/p><ol><li>stylesheets<\/li><li>scripts<\/li><\/ol><p>so all of our web pages which has a dependency for the third-party CSS\/JS libraries will look like following,<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0ecac9e elementor-widget elementor-widget-code-highlight\" data-id=\"0ecac9e\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp>@extends('layouts.app') \n@section('stylesheets')     \n<link rel=\"stylesheet\" href=\"https:\/\/rawgit.com\/fronteed\/iCheck\/1.x\/skins\/all.css\">\n@endsection \n\n@section('content')     \n....content here.... \n@endsection \n\n@section('scripts')     \n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/iCheck\/1.0.2\/icheck.min.js\"><\/script>\n@endsection<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-80b2da8 elementor-widget elementor-widget-text-editor\" data-id=\"80b2da8\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>As per the above example, the iCheck library will be only added on pages where we are actually using iCheck instead of all of my web pages.<\/p><h2>Solution 2. Separating out page level CSS or JS<\/h2><p>To resolve this problem, we also declared two new sections in the layout file.<\/p><ol><li>page_css<\/li><li>page_js<\/li><\/ol><p>page_css section will contain page level CSS and page_js section will contain page level javascript like initializing datatable or checkboxes etc. Also, all page level CSS and JS are not placed directly inside the blade file. But we go one step further.<\/p><p>Under the resources\/assets folder, we have two folders,<\/p><ul><li>js<ul><li>contains all page level JS for different blade files<\/li><\/ul><\/li><li>styles<ul><li>contains all page level CSS for different blade files<\/li><\/ul><\/li><\/ul><p>We tried to follow the same folder structure for this that we used for our blade views.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-253db17 elementor-widget elementor-widget-image\" data-id=\"253db17\" data-element_type=\"widget\" data-widget_type=\"image.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t\t\t\t\t\t\t<img fetchpriority=\"high\" decoding=\"async\" width=\"772\" height=\"484\" src=\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/assets-folder-structure.png\" class=\"attachment-large size-large wp-image-3796\" alt=\"Laravel App - Code Optimizations Tips\" srcset=\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/assets-folder-structure.png 772w, https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/assets-folder-structure-300x188.png 300w, https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/07\/assets-folder-structure-768x481.png 768w\" sizes=\"(max-width: 772px) 100vw, 772px\" \/>\t\t\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-5b456fb elementor-widget elementor-widget-text-editor\" data-id=\"5b456fb\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>If you have multiple files then you can try to use names like index.js, edit.js, etc, just the same as your blade view names.<\/p><p>And in your blade view files, you can include them as a script or stylesheet. For e.g.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-3d5dd41 elementor-widget elementor-widget-code-highlight\" data-id=\"3d5dd41\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp>@section('page_js')     \n<script src=\"{{ mix('assets\/js\/task\/task.js') }}\"><\/script>\n@endsection<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-656d0a5 elementor-widget elementor-widget-text-editor\" data-id=\"656d0a5\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>Note: Use of mix is explained in the next section. so you can just ignore that as of now. But the basic idea is, include them as a script or stylesheet with sections, instead of directly putting them in blade files.<\/p><h2>Solution 3. Using laravel-mix<\/h2><p>Laravel mix is a great tool for asset compilation. All of the page level JS\/CSS files and other common JS\/CSS should be compiled by laravel mix and should be copied to the public folder with versioning for cache busting. And then it will be included via mix helper in our blade views. (As explained in the above solution at the bottom of the section).<\/p><p>For e.g. our webpack.mix.js looks like the following,<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b6aabda elementor-widget elementor-widget-code-highlight\" data-id=\"b6aabda\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp>\/* CSS *\/ \nmix.sass('resources\/assets\/style\/sass\/laravel\/app.scss', 'public\/assets\/style\/css\/app.css') \n.sass('resources\/assets\/style\/sass\/style.scss','public\/assets\/style\/css\/style.css') \n.sass('resources\/assets\/style\/sass\/dashboard.scss','public\/assets\/style\/css\/dashboard.css')\n.version(); \n\n\/* JS *\/ \nmix.js('resources\/assets\/js\/custom.js','public\/assets\/js\/custom.js') \n.js('resources\/assets\/js\/users\/user.js','public\/assets\/js\/users\/user.js') \n.js('resources\/assets\/js\/task\/task.js','public\/assets\/js\/task\/task.js')    \n.version();<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-63f194e elementor-widget elementor-widget-text-editor\" data-id=\"63f194e\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<p>This will minify our code and make it secure in the production environment.<\/p><p>Hope this helps.<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t\n    <div class=\"xs_social_share_widget xs_share_url after_content \t\tmain_content  wslu-style-1 wslu-share-box-shaped wslu-fill-colored wslu-none wslu-share-horizontal wslu-theme-font-no wslu-main_content\">\n\n\t\t\n        <ul>\n\t\t\t        <\/ul>\n    <\/div> \n","protected":false},"excerpt":{"rendered":"<p>Last month we started working on one of our internal project called InfyTracker, which we were planning to use as a&#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"postBodyCss":"","postBodyMargin":[],"postBodyPadding":[],"postBodyBackground":{"backgroundType":"classic","gradient":""},"two_page_speed":[],"footnotes":""},"categories":[9],"tags":[],"class_list":["post-3794","post","type-post","status-publish","format-standard","hentry","category-laravel"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Laravel App - Code Optimizations Tips<\/title>\n<meta name=\"description\" content=\"Boost Laravel performance with code optimization tips, load page-specific assets, modularize files, use Laravel Mix, cache views\/routes.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Laravel App - Code Optimizations Tips\" \/>\n<meta property=\"og:description\" content=\"Boost Laravel performance with code optimization tips, load page-specific assets, modularize files, use Laravel Mix, cache views\/routes.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/\" \/>\n<meta property=\"og:site_name\" content=\"Blog | InfyOm Technologies\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/infyom\" \/>\n<meta property=\"article:published_time\" content=\"2019-06-19T13:01:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-07-17T07:37:05+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/infyblog.zluck.in\/wp-content\/uploads\/2024\/07\/assets-folder-structure.png\" \/>\n<meta name=\"author\" content=\"InfyOm\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InfyOm\" \/>\n<meta name=\"twitter:site\" content=\"@InfyOm\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"InfyOm\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/\"},\"author\":{\"name\":\"InfyOm\",\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/person\/659bfc844c333d041221e83c5f5ec754\"},\"headline\":\"Laravel App &#8211; Code Optimizations Tips\",\"datePublished\":\"2019-06-19T13:01:02+00:00\",\"dateModified\":\"2025-07-17T07:37:05+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/\"},\"wordCount\":906,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/infyom.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/infyblog.zluck.in\/wp-content\/uploads\/2024\/07\/assets-folder-structure.png\",\"articleSection\":[\"Laravel\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/\",\"url\":\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/\",\"name\":\"Laravel App - Code Optimizations Tips\",\"isPartOf\":{\"@id\":\"https:\/\/infyom.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/infyblog.zluck.in\/wp-content\/uploads\/2024\/07\/assets-folder-structure.png\",\"datePublished\":\"2019-06-19T13:01:02+00:00\",\"dateModified\":\"2025-07-17T07:37:05+00:00\",\"description\":\"Boost Laravel performance with code optimization tips, load page-specific assets, modularize files, use Laravel Mix, cache views\/routes.\",\"breadcrumb\":{\"@id\":\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#primaryimage\",\"url\":\"https:\/\/infyblog.zluck.in\/wp-content\/uploads\/2024\/07\/assets-folder-structure.png\",\"contentUrl\":\"https:\/\/infyblog.zluck.in\/wp-content\/uploads\/2024\/07\/assets-folder-structure.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/infyom.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Laravel App &#8211; Code Optimizations Tips\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/infyom.com\/blog\/#website\",\"url\":\"https:\/\/infyom.com\/blog\/\",\"name\":\"Blog | InfyOm Technologies\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/infyom.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/infyom.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/infyom.com\/blog\/#organization\",\"name\":\"InfyOm Technologies\",\"url\":\"https:\/\/infyom.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/06\/InfyOm-Logo.png\",\"contentUrl\":\"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/06\/InfyOm-Logo.png\",\"width\":88,\"height\":41,\"caption\":\"InfyOm Technologies\"},\"image\":{\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/infyom\",\"https:\/\/x.com\/InfyOm\",\"https:\/\/www.instagram.com\/infyomtechnologies\/\",\"https:\/\/in.linkedin.com\/company\/infyom-technologies\",\"https:\/\/github.com\/infyomlabs\",\"https:\/\/x.com\/infyom\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/person\/659bfc844c333d041221e83c5f5ec754\",\"name\":\"InfyOm\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/infyom.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/1ad162864d8d33c04ea9e6d0333cc483?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/1ad162864d8d33c04ea9e6d0333cc483?s=96&d=mm&r=g\",\"caption\":\"InfyOm\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Laravel App - Code Optimizations Tips","description":"Boost Laravel performance with code optimization tips, load page-specific assets, modularize files, use Laravel Mix, cache views\/routes.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/","og_locale":"en_US","og_type":"article","og_title":"Laravel App - Code Optimizations Tips","og_description":"Boost Laravel performance with code optimization tips, load page-specific assets, modularize files, use Laravel Mix, cache views\/routes.","og_url":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/","og_site_name":"Blog | InfyOm Technologies","article_publisher":"https:\/\/www.facebook.com\/infyom","article_published_time":"2019-06-19T13:01:02+00:00","article_modified_time":"2025-07-17T07:37:05+00:00","og_image":[{"url":"https:\/\/infyblog.zluck.in\/wp-content\/uploads\/2024\/07\/assets-folder-structure.png","type":"","width":"","height":""}],"author":"InfyOm","twitter_card":"summary_large_image","twitter_creator":"@InfyOm","twitter_site":"@InfyOm","twitter_misc":{"Written by":"InfyOm","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#article","isPartOf":{"@id":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/"},"author":{"name":"InfyOm","@id":"https:\/\/infyom.com\/blog\/#\/schema\/person\/659bfc844c333d041221e83c5f5ec754"},"headline":"Laravel App &#8211; Code Optimizations Tips","datePublished":"2019-06-19T13:01:02+00:00","dateModified":"2025-07-17T07:37:05+00:00","mainEntityOfPage":{"@id":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/"},"wordCount":906,"commentCount":0,"publisher":{"@id":"https:\/\/infyom.com\/blog\/#organization"},"image":{"@id":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#primaryimage"},"thumbnailUrl":"https:\/\/infyblog.zluck.in\/wp-content\/uploads\/2024\/07\/assets-folder-structure.png","articleSection":["Laravel"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/","url":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/","name":"Laravel App - Code Optimizations Tips","isPartOf":{"@id":"https:\/\/infyom.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#primaryimage"},"image":{"@id":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#primaryimage"},"thumbnailUrl":"https:\/\/infyblog.zluck.in\/wp-content\/uploads\/2024\/07\/assets-folder-structure.png","datePublished":"2019-06-19T13:01:02+00:00","dateModified":"2025-07-17T07:37:05+00:00","description":"Boost Laravel performance with code optimization tips, load page-specific assets, modularize files, use Laravel Mix, cache views\/routes.","breadcrumb":{"@id":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#primaryimage","url":"https:\/\/infyblog.zluck.in\/wp-content\/uploads\/2024\/07\/assets-folder-structure.png","contentUrl":"https:\/\/infyblog.zluck.in\/wp-content\/uploads\/2024\/07\/assets-folder-structure.png"},{"@type":"BreadcrumbList","@id":"https:\/\/infyom.com\/blog\/laravel-app-code-optimizations-tips\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/infyom.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Laravel App &#8211; Code Optimizations Tips"}]},{"@type":"WebSite","@id":"https:\/\/infyom.com\/blog\/#website","url":"https:\/\/infyom.com\/blog\/","name":"Blog | InfyOm Technologies","description":"","publisher":{"@id":"https:\/\/infyom.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/infyom.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/infyom.com\/blog\/#organization","name":"InfyOm Technologies","url":"https:\/\/infyom.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/infyom.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/06\/InfyOm-Logo.png","contentUrl":"https:\/\/infyom.com\/blog\/wp-content\/uploads\/2024\/06\/InfyOm-Logo.png","width":88,"height":41,"caption":"InfyOm Technologies"},"image":{"@id":"https:\/\/infyom.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/infyom","https:\/\/x.com\/InfyOm","https:\/\/www.instagram.com\/infyomtechnologies\/","https:\/\/in.linkedin.com\/company\/infyom-technologies","https:\/\/github.com\/infyomlabs","https:\/\/x.com\/infyom"]},{"@type":"Person","@id":"https:\/\/infyom.com\/blog\/#\/schema\/person\/659bfc844c333d041221e83c5f5ec754","name":"InfyOm","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/infyom.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/1ad162864d8d33c04ea9e6d0333cc483?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/1ad162864d8d33c04ea9e6d0333cc483?s=96&d=mm&r=g","caption":"InfyOm"}}]}},"_links":{"self":[{"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/posts\/3794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/comments?post=3794"}],"version-history":[{"count":7,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/posts\/3794\/revisions"}],"predecessor-version":[{"id":8152,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/posts\/3794\/revisions\/8152"}],"wp:attachment":[{"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/media?parent=3794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/categories?post=3794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/infyom.com\/blog\/wp-json\/wp\/v2\/tags?post=3794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}