Context:
I have a customer who wishes to have two small web applications built within his current WordPress application. Since I always work with a combination of Laravel / VueJS, I decided to integrate this application into WordPress. The size of the application is so small, that it would be a waste of time for me to dive into an other framework or using bare php.
Problem:
The web applications have to reside in the public_html folder, see below. Laravel sets the public path, which in this case is not correct. Packages/plugins also rely on this, as does Laravel mix. Because WordPress also resides in the public_html folder, this folder already contains an index.php, and some other php files. While I can place the Laravel folder structure outside public_html (security measures), I need to find a place for Laravel's index file, which also needs the adjustments so everything that needs to be accessible, is accessible.
Just to be clear. The applications will have 2 URL's which will reroute to Laravel.
xxx.com/declaraties/yyy
xxx.com/rapportages/yyy
Folder structure:
/root folder (welcome to shared hosting....)
/app
/bootstrap
/config
/database
/node_modules
/public_html
/wordpress folders
/declaraties (web app 1)
favicon
assets etc
/rapportages (web app 2)
favicon
assets etc
/resources
/routes
/storage
/vendor
laravel related files (env, artisan, server.php, etc)
Any help towards a solution would be greatly appreciated.
I think you can have a try with Laraish, a WordPress theme that uses Laravel.
Related
In Laravel 9 where it uses Vite to bundle the js and css files, after running
npm run build
it created the bundled js and css files inside public/build folder.
Can we now delete the original js and css files that are created inside resources? or to upload the project to hosting without this resources folder?
Also, if I have other css/js files but not inside Resources folder, should I add them manually to the input array inside the vite.config.js file to get them compiled and bundled ?
Thanks
It depends on the assets you have in resources directory.
This directory can hold un-compiled front-end assets such as CSS or JavaScript - those will be bundled and available in public folder and served from there, therefore it's safe to delete them on the shared hosting.
However, this directory can also hold backend assets like views, and those files will be read by Laravel directly on shared hosting. If you delete them, your Laravel application will crash.
Therefore, if the only assets you have in the folder are frontend ones that are bundled and served from public, it is safe to remove this directory, howevever there won't be any performance improvement coming from that.
I am just starting to learn Laravel and have some questions about the directory structure, updating with composer, gulp, bower, the "public" folder, "resources", etc. Sorry, I am a newbie.
I got a Laravel Admin template online, so the setup there may be different than the raw install, but it seems basically the same:
app
bootstrap
config
database
public
resources
storage
tests
vendor
My question regards the assets folder under public and the assets folder under resources. The template that I have uses gulp and bower, so my question is if I change some css or javascript for one of my files, should I do that in the /resources/assets path or the /public/assets path ? Seems like you should update the resources and then do update with bower and gulp, otherwise your changes could get overwritten. Does that apply to everything in the /resources/assets path ? Update there and then update your /public/assets path ?
It does seem a little strange that the resources folder is essentially your development assets that can be compiled, but the views are in the resources folder, not the public folder. Is that because they are xxx.blade files.php files, development files and are sort of compiled into xxx.php virtual files in the public directory at runtime ?
You use Gulp and Bower to compile your custom assets in a more efficient way. If the template you downloaded makes use of these tools then you need to make your changes in the source files you feed Gulp/Bower and they take care of the rest and place the results in /resources/assets.
The /public/assets folder is where you or the template you downloaded save assets won't be edited by Gulp/Bower and can be accessible from the root path of your project. What ever you edit here will be kept like that until you make any manual modification again.
I am working on a small project to maintain email lists. I am not using any frameworks for this project. I am planning to use phing for deployment.
I have two questions:
- Is this a good project structure for a simple project.
- How do I redirect the calls to my view files in src folder. For ex: http://localhost/test/mydashboard.php since the view files are in src folder. Is some sort of symlink or mod rewrites needed?
- somewhat related to my second question is should the folder structure be any different on production for this project.
Can somebody explain in brief the use of assets folder in yii framework. I am new to yii framework
Many newcomers ask: "What do we do with the assets folder?", and the answer is "Mostly nothing".
It's important that the directory be writable by the webserver user so that Yii can publish the resources there when needed.
When a project has multiple versions (production, testing, development, etc.) do not copy the assets/ folders from one area to another; allow Yii to deploy them automatically in each area.
Do not manually edit any file under assets/ - if you have a real need to make a change, find the publishing module, edit the source, delete the subfolder under assets/, and let Yii re-publish the updated files.
Do not reference names under the assets/ folder directly (say, to get at some other module's assets). If you need to use that
Do not add the contents of the assets/ folder to any source-code control system; these files have master source in other places.
It is safe to delete everything under assets/. Yii will re-publish the assets if they are not found under assets/.
Additional info
Yii makes assets accessible by Web clients, so the goal of copying assets to a Web-accessible directory is fulfilled and returns the corresponding URL for accessing them.
Read it from http://www.yiiframework.com/doc/api/1.1/CAssetManager
I have just completed a fresh install of PyroCMS on a dev server and it appears that the system and addons folder reside above the document root folder within "public_html".
PyroCMS is based off of CodeIgniter and every time I did a CodeIgniter install it always had me place the system folder below the document root for security purposes. Shouldn't this be true with the PyroCMS install?
Modules require assets, which of course means HTTP access is required. We plan to eventually improve the Asset helper to GZIP/minify/combine everything and pass it through an "asset" controller, meaning images can be cached and resized, javascript can be squashed, etc.
Putting everything through a PHP file in this way means eventually you'll be able to have everything outside of the public folder, but for now you need direct access or you are entirely screwing with your chances of having a theme with images, css, javascript or icons.
Just don't tell Apache to serve PHP files as text/plain and you'll be absolutely fine. ;-)