Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I'm having a trouble on how to implement Single Page Application on Laravel blade php file format using Vue-router, is that possible?.The reference link below says that it is impossible to use SPA on php file format and I'm here to ask to confirm if this is not possible, but I guess there is other solution with this issue. It would be great if anybody could figure out, thank you so much in advance!.
Reference
For example with this file it should blade.php instead of vue
Not possible ..laravel have some standards that need to follow
Blade view files use the .blade.php file extension and are typically stored in the resources/views directory.
SPA are fast since most resources (HTML,CSSS,Scripts etc) and DOM components are only loaded once throughout the entire cycle of an application. Subsequently, only dynamic content is loaded by JS, which speeds up the site remarkably.
If you are using blade then it needs to reload for every changes to reflect then what points of using it
Refer this: https://laravel-news.com/using-vue-router-laravel
Personally I would opt for L8 with inertiajs(vuejs) which is integrated in the documentation and you can easily make a SPA
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Due to a very long lifetime of a system, I have a complicated setup, where part of the code is written in Laravel, and the other part is mostly in plain PHP.
Laravel is booted in the non-Laravel-part, so that I can use Laravel functions in plain php files. I can call Laravel's helper functions and use other Laravel functionality in php files.
As we are slowly moving our non-Laravel-code to Laravel, I would like to include blade files in those plain php files. Is there a way to achieve that?
In the comments, #Ballard suggested using Laravel's view helper.
Including blade files seems to work like this in php files:
echo view('partials.testblade', ['somevar' => "hello"])->render();
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a project and using angular as front end and PHP as back end, installed both in different domains, PHP project is complete and working. I have created API in PHP and in angular I will call that API.
can I do like copy PHP project into angular src folder and run or using different domains how can I call API Or how?
what is the most used way for doing this I have seen tutorials over this but not able to get it correctly?
so can you please tell me any way to work,please give me your suggestion and thoughts
This is quite a big question really.
No-one will be able to give you an answer as to how to do what you're trying to achieve in a single stackoverflow post. It's like asking "how do I build a car?" - there are many steps involved to complete this process. Your best bet is to follow a tutorial.
In my experience, having separate applications for front end and backend is quite common.
You should keep your PHP project separate to your Angular project instead of mixing them.
You should follow a tutorial on how to build a full stack application such as these:
https://morioh.com/p/f2ad5d91a8dd
https://phpenthusiast.com/blog/develop-angular-php-app-getting-the-list-of-items
https://www.techiediaries.com/angular/angular-9-php-mysql-database/
Good luck!
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have a Question about prerendering a vue app built with php ( laravel or pure php it doesn't matter )
My question is how really prerendering work with dynamic content For example:
when I make a blog with vue and php to show post I make Ajax Request in my vue app.. how google bots and other web crawlers will read my site content
Thanks in advance
The concept of prerendering is most used in SPA. It consists of rendering a placeholder or dynamic elements until the JavaScript code makes the necessary Ajax requests and uses the requested data to render new elements.
You can use prerendering to server-side render the HTML that you want to make indexable for the search engines. Using PHP and Vue.js to achieve that can be complex because you need to have a view for the PHP template engine and another one for Vue.js. It can be difficult to maintain when the application grows.
I've used hypernova to achieve that (Laravel and Vue.js). I wrote a couple of articles about it
https://dev.to/phillipgd1992/universal-rendering-in-laravel-using-vue-js-and-ara-framework-5amd
https://itnext.io/strangling-a-monolith-to-micro-frontends-decoupling-presentation-layer-18a33ddf591b
You can read more about prerender, ssr, csr and universal rendering here:
https://developers.google.com/web/updates/2019/02/rendering-on-the-web#seo
Let me know if I can help you with something else.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I've designed my site template with html and I'm newbie in laravel. I wrote template of my site and now I'm going to apply laravel code to it. Is it possible without changing the template of site, I apply laravel code?
Depending on what you're intending to do. You can easily integrate your current HTML within Laravel. Laravel comes with Blade, which is a templating language. You can echo various data from your Laravel backend to your views (your HTML in your case).
It's essentially how you'd normally convert a static HTML to dynamic with some PHP <?php echo $username; ?>, except, Blade provides a cleaner syntax, along with other features like extending layout files etc.
You can make a result with controller in laravel and pass result to blade template to show it.
You can read it for more details :
https://laravel.com/docs/5.5/views
now, you can use #php , #endphp for write php code in blade template directly. I recommend don't use this method, But if you had to and no choice, this method is exists.
https://laravel.com/docs/5.5/blade#php
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have recently start work with twig in my project,
I have check that twig have create cache folder, and check that twig basically create some php classes for cache,
I want to understand exactly how this mechanism is work, how it beneficial to reduce the page loading time, any one can help me ?
Twig evaluation process looks like:
Your templates are parsed, abstract syntax tree (AST) is built from then and then AST is transformed into php code
Php code from the step #1 is evaluated
With Twig templates caching you eliminate step #1, since the transformation results are written to a cache files.
So it is highly recommended to use it on production. Just make sure you clear the template directory cache on deploy or specify another directory as a target. It could be a good idea to include the application version number in the path.