Book Image

Laravel 5.x Cookbook

By : Terry Matula, Alfred Nutile
Book Image

Laravel 5.x Cookbook

By: Terry Matula, Alfred Nutile

Overview of this book

Laravel is a prominent member of a new generation of web frameworks. It is one of the most popular PHP frameworks and is also free and an open source. Laravel 5 is a substantial upgrade with a lot of new toys, at the same time retaining the features that made Laravel wildly successful. It comes with plenty of architectural as well as design-based changes. The book is a blend of numerous recipes that will give you all the necessary tips you need to build an application. It starts with basic installation and configuration tasks and will get you up-and-running in no time. You will learn to create and customize your PHP app and tweak and re-design your existing apps for better performance. You will learn to implement practical recipes to utilize Laravel’s modular structure, the latest method injection, route caching, and interfacing techniques to create responsive modern-day PHP apps that stand on their own against other apps. Efficient testing and deploying techniques will make you more confident with your Laravel skills as you move ahead with this book. Towards the end of the book, you will understand a number of add-ons and new features essential to finalize your application to make it ready for subscriptions. You will be empowered to get your application out to the world.
Table of Contents (17 chapters)
Laravel 5.x Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Using sequel pro and connecting to local and remote databases


Soon, we will be doing migrations, saving data to the database, and other day-to-day workflows, but sometimes, it is nice to look into the database. For example, you may want to export Production and the environment that has your live data down to local to review some bug. This section will show how to use Sequel Pro to do secure, over SSH, connections to your database. This allows you to get to your database with almost zero risk other than SSH.

How to do it...

The following are the steps to connect sequel pro to local and remote databases:

  1. Download and install Sequel Pro from http://www.sequelpro.com/.

  2. Add a new connection to Homestead:

  3. Add new connection to a remote Host:

How it works...

In the past, I have used phpMyAdmin, and it was better than just the command line. But Sequel Pro really was a game changer. For one, I did not have to install phpMyAdmin on my servers and risk issues related to security. Second, it is a good interface and makes it really easy to check out data, tables, do queries, and so on when needed.

So, what you saw previously was simply a setup for Homestead using the Standard tab and Port 33060, which is what Homestead forwards its MySQL port to.

When we deploy our first server, it will have SSH port 22 open, but never will I have MySQL open only on 127.0.0.1.

Tip

For the most part, you only want three ports open on your server: 22 for SSH, 80 to redirect web requests to SSL/HTTPS, and 443 to serve your website.

So, to connect to this we select the SSH tab, and enter the information for the database on the server, since we will be on the server after the SSH step. Then, we enter the information for SSH; in this case, I had to go into my home folder to use my SSH public key. If you did not set up a key on your server, then most likely, you are using a password, so enter that instead.

Tip

If you do not have the a.ssh folder in your Home directory (~/), then take a moment to create it. From the command line, run ssh-keygen –t rsa and just answer yes to all the questions. Do not add a password. You now have a public key.

It is really this simple. Now, you have this great UI to look into your database once in a while; though after using Laravel with php artisan migrate and eloquent, I am not in the database often.

See also