Search code examples
phpyii2phundament

yii2 and phundament moving from dev to prod


I was developing with yii2 and phundament and works all super nice in my local box and my host server but what i still confuse is about how to move from dev to prod.

Which folders can I delete from the final production?

I need the app to work in a raspberry Pi that's why i need to reduce the files in production.


Solution

  • I understand that you are deploying your Yii2 app on a limited-space raspberry Pi, so here are some suggestions (it might be worth adding that back in to your question, as that justifies the reason for your question).

    You can't just deleted files or folders. Yii needs them to run, but you can configure Yii to use less of them.

    Changing your logging levels, or setting a smaller flush interval will save a lot of space in your runtime folder.

    You could also combine and minify all your assets (js and css), so that only one set of assets gets published. You would need to do this manually, I don't know of any way of getting Yii to do this automatically.

    Make sure that you actually need all the vendor components that are present. If there are some you don't need, like imagine, or swiftmailer, then remove them using composer, which will deleted them from your vendor folder and also remove the autoload references.

    If you are finished testing, you could probably remove the 'tests' folder but try just renaming it first to make sure everything still works.

    Finally, if you're not using them, you could probably remove the mail and migrations folders and their contents, but that's not likely to save much space.

    There may be other space-saving methods, but that's all I could come up with!