Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Clausi's avatar

Deployment and repositories

Hi all,

we are just starting with Laravel over here, and are currently trying to understand how Laravel works, before we start our first project with it. We are a small team (3) and need like to work on the same site.

My first question concerns deployment and repositories. The production app will reside on a server, and we are all working locally on our own PCs to code and test. What is the recommended way for uploading the laravel app to the server? I.e. Should all of us synchronize the entire laravel path or just the app/config/database/resources directories with a repository (we have been using SVN till now) and the server admin just overwrites these directories from the repos and runs the migrations?

Or should this be stored in a way it can always be updated/installed via composer? How can this be done? I see how composer can be used to update the vendors directory, but how can we get in our own stuff on the server (in the app/config etc directories)?

I guess this must be answered somewhere, but I could not find it. Any hints or recommendations? The project, for the time being is not yet open source, mainly for security reasons.

0 likes
5 replies
davorminchorov's avatar

Configuration stuff which is for development should go to .env file (Laravel 5) or .env.development.php (Laravel 4) and return an array like:


//.env file
return [
    // local database and API keys config goes here - these will probably be different for production
    'CONFIG_NAME' => 'yourconfighere',
    'ANOTHER_CONFIG_NAME' => 'youranotherconfighere'
];

// config file 

$config = env('CONFIG_NAME');
$anotherConfig = env('ANOTHER_CONFIG_NAME');

Everyone can use different config for development (but I think it's better if you stick with the same config) and when you deploy stuff to your production server use the .env file array to setup the server config variables (or environment variables , different for every server).

Docs: http://laravel.com/docs/5.0/configuration#environment-configuration

.env file should be only for local development and should be ignored by SVN (don't upload it to your repository) Also ignore the vendor, node_modules, bower_components folders etc. by SVN (everything else which is for development only)

Run composer install and php artisan migrate on the server to setup the app and the database.

I hope this will help you.

Clausi's avatar

@Ruffles I am aware of the env() functionalility, but my question was more directed towards the files. I.e. say one developer adds a new functionality to the system, and he needs to put a new file in /config (which might as well come from some package he added). How does this file get from the local machine to the server? As well, new views and controllers? They are uploaded to a SVN from the developers and then downloaded from the SVN on the server by admin?

bobbybouwmann's avatar

If you work with version control then you just push your stuff to your GIT/SVN server and then deploy it to the server. Every member of the team then gets their stuff from the GIT/SVN server every day.

But working on one project is kinda hard with 3 guys and version control. I mean, you want to add a new route and then your colleague want that as well, how do you handle that? That will only give you conflicts! Just saying :P I have expierence with that from school :P

Please or to participate in this conversation.