Skip to content

Instantly share code, notes, and snippets.

@maxxscho
Last active February 19, 2020 10:36
Show Gist options
  • Save maxxscho/8e6a5e6378f969c6c8b6 to your computer and use it in GitHub Desktop.
Save maxxscho/8e6a5e6378f969c6c8b6 to your computer and use it in GitHub Desktop.
Homestead Base Setup

Timezone

  1. Check your current timezone with date in the command line. You should get something like this. Fri Oct 3 10.32:13 UTC 2014 where UTC is your current timezone.
  2. To change your timezone just run sudo dpkg-reconfigure tzdata and follow the instructions. Easy!
  3. Check the timezone again with date. Now your timezone should be in this example CEST

Locale

Homestead provides an Ubuntu System and has by default only english locales installed. In PHP locales are important if you work for example with strftime. Check the currently installed locales with locale -a. To add a new locale, you have to generate it. For example for a german locale enter sudo locale-gen de_DE.UTF-8 If you check again, the new locale should be included.

phpMyAdmin

Source: StackOverflow

Simplest way I've found so far is to create a new server block (vhost) for phpmyadmin.

Assuming that your projects live in home/vagrant/Code :

  1. sudo apt-get install phpmyadmin Do not select apache2 nor lighttpd when prompted. Just hit tab and enter.
  2. sudo ln -s /usr/share/phpmyadmin/ /home/vagrant/Code/phpmyadmin
  3. cd ~/Code && serve phpmyadmin.app /home/vagrant/Code/phpmyadmin
  4. Open the /etc/hosts file on your host machine and add 127.0.0.1 phpmyadmin.app
  5. Go to http://phpmyadmin.app:8000

Mailcatcher

Source Adam Engebretson

// Install MailCatcher
$ sudo apt-get install ruby1.9.1-dev libsqlite3-dev
$ sudo gem install mailcatcher
// Run Mailcatcher
$ mailcatcher --ip 192.168.10.10

Run MailCatcher - the IP depends on the Homestead IP - configurable in Homestead.yaml Make an alias for MailCatcher in the 'aliases' file

alias mailcatcher='mailcatcher --ip 192.168.10.10'

You can now access MailCatcher in your browser at http://192.168.10.10:1080

To use MailCatcher in your Laravel application, you'll have to edit the configuration in /app/config/mail.php. However, it's recommended to copy this file to /app/config/local/mail.php so that the configuration only applies to your local development environment. Here's my mail.php config file.

<?php

return [

  'driver'     => 'smtp',

  'host'       => '192.168.10.10',

  'port'       => 1025,

  'from'       => array('address' => 'test@example.com', 'name' => 'Test Email Sender'),

  'encryption' => false,

  'username'   => null,

  'password'   => null,

];

It's important that you set the port to 1025, and you disable encryption

Debugging with X-Debug and PHPStorm

Source: Elena Kolevska - Debugging Laravel Apps on Homestead (PhpStorm + Xdebug + Postman setup)

Additional XDebug Settings for Sublime

xdebug.remote_handler=dbgp
xdebug.remote_host=10.0.2.2

Project Settings in Sublime Text

"settings": {
        "xdebug": {
            "path_mapping": {
                     "home/vagrant/path/to/your/folder" : "/Users/markus/path/to/your/folder",
            },
        "url": "http://tc-verwaltung.app",
        "super_globals": true,
        "close_on_stop": true
    }
}

http://www.sitepoint.com/debugging-xdebug-sublime-text-3/ http://mattwatson.codes/debug-php-vagrant-using-xdebug-sublime-text/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment