Hi
Please, I would like to know how to proceed to put my API slim on an online server once the local development is finished …
By ftp? or how ?
Thanks for your help
Hi
Please, I would like to know how to proceed to put my API slim on an online server once the local development is finished …
By ftp? or how ?
Thanks for your help
That depends on the features you are looking for. Some hosting services like fortrabbit will take care of it for you via Git. Others like Beanstalk or DeployBot will handle SFTP (and other transfers) for you. Or you can do it manually via SFTP, or use something like rsync.
It depends on the server setup/environment.
For deployment on a productive server, there are some important settings and security releated things to consider.
You can use composer to generate an optimized build of your application. All dev-dependencies are removed and the Composer autoloader is optimized for performance.
composer install --no-dev --optimize-autoloader
Furthermore, you should activate caching for Twig to increase the performance of the template engine.
Routing can also be accelerated by using a cache file.
Set the option displayErrorDetails
to false
in production.
Then I would create a so called “artifact” in form of a ZIP (or whatever you want) file. You can upload this single file (much faster) via FTP/SFTP/FTPS. On the server, the archive is getting extracted and the old application directory replaced by the new applications directory. If necessary, you can perform database migrations at the end.
Thank so much.
I would like to ask if your recommendation is useful for an api rest for an Android application…
Because I am developping the api for it.
If your have a link Which explains how to do it ant the different step please help me.
PS: l’m beginner, so thank
For the beginning I would recommend to learn something about Continuous delivery and Continuous deployment
This book is very good: Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation, Video Enhanced Edition.
Video from Javier Lopez: Continuously delivering PHP projects
More links about CI and CD
I’m building artifacts with Apache Ant (build.xml) and deploy it with a tiny php script (deploy.php) to production.
Thnak so much…
Plear dear Odan, for this commande
Blockquote
composer update --no-dev --optimized-autoloader
Blockquote
I must be in what the project directory before performing it ?
Thank for explanation…
Sorry a typo. Try
composer install --no-dev --optimize-autoloader
please, to perform this command i was be in what directory ?
Run this command in the same directory as the project’s composer.json
file.
https://getcomposer.org/doc/articles/autoloader-optimization.md