doucai6663 2017-04-12 23:13
浏览 36
已采纳

将作曲家放在将要用于其他项目的CMS中的位置?

Currently I am developing a small headless CMS. If anyone wants to use it he should just copy the root folder of my CMS and put it into his public_html folder. So for any requests to the CMS the URL looks like this:

example.com/my-cms-name/subfolder/...

To better organize third-party libraries I decided to use composer. But now I have the composer.json file and the vendor file in my CMS folder which is going to be in the public_html folder. So everything from composer will be available for everybody which is obviously not a good practice.

How can I overcome this problem? Should I do all composer things separately in a different folder? But then the user of my CMS has to include multiple folders into multiple directories which makes everything more complicated...

  • 写回答

1条回答 默认 最新

  • donglangtun1850 2017-04-13 00:24
    关注

    I agree to Half Crazed. Probably people will have to upload your CMS files via FTP anyway and set a root path. So you might as well divide your scripts in private and public ones. So a directory structure like this might be a good idea.

    -config
    -public_html (root path that people must point their domain to)
     -css
     -javascript
     -images
     -index.php
     -.htaccess (optional)
    -src (where your namespaced script should reside )
    --MyApp
    -vendor
    -composer.json
    -composer.lock
    

    Update composer.json and add your own src, run update command. Then include the vendor autoload.php in your index.php and go the router/controller way.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程