PHPView sudden breakdown

Hello,
I don’t know if this has been answered already. My project structure
-src
–public/index.php
–template/test.html
–vendor/js/test.js

In my template ,I accessed test.js as “…/vendor/js/test.js” . This worked fine earlier but I upgraded my php to version 7 and now the resource is not accessible anymore ( I am using Slim’s default PHPRenderer) . Instead of looking at /src/vendor/ , its looking at /src/public/vendor/ . My .htaccess is same as given in documentation

Please suggest me a different(correct?) way for resource inclusion ,or what wrong could I have done.

Normally the vendor folder is reserved exclusively for composer. You should not use this name for other things. You should revise your complete folder structure. Here’s a suggestion:

config             Configuration files
public             Public web server files (DocumentRoot)
   js              Public JavaScript files
   css              Public CSS files
  .htaccess        Apache redirect rules for the front controller
  index.php        The front controller
templates          Twig (or PHP) templates
src                PHP source code (The App namespace)
vendor             Reserved for composer
1 Like

Thanks , this is much cleaner.

However , i have downloaded an external template theme and it has every dependency in vendor directory. I have no experience with angular and js stuff , so i just merged the two. It may save a lot of time if i am able to include my vendor directory without having to seperate so many packages

Hi,I used DIR and removed relative paths,it works well now. This can be closed