2017-04-09 12:00:04 ][ Tags: hacking php laravel
For some reason there is a whole thread on this seemingly simple tasks. In a bootstrapped Laravel 5.4 instance the following worked for me.
Adding the following to your elixir config in the
My complete gulpfile looks like this:
If you run
gulp you should be able to now start using font-awesome
everywhere in your app.
2017-04-08 17:49:15 ][ Tags: hacking php laravel docker
Docker is awesome. Its also quite useful for local development. The following Dockerfile and docker-compose.yml will be helpful if you want to do laravel development inside of docker. I am using Ubuntu as a base, but you can probably use the official PHP image as well. Dockerfile
FROM ubuntu:16.04 RUN apt update RUN apt install -y php7.0 php7.0-zip php7.0-mbstring phpunit curl php7.0-mysql RUN curl -sS https://getcomposer.org/installer | php RUN mv composer.phar /usr/local/bin/composer RUN composer global require "laravel/installer" RUN export PATH=$HOME/.config/composer/vendor/bin:$PATH
version: '2' services: app: build: . ports: - "8000:8000" volumes: - .:/code env_file: .env working_dir: /code command: bash -c 'php artisan migrate && php artisan serve --host 0.0.0.0' depends_on: - db db: image: "mysql:5.7" environment: - MYSQL_ROOT_PASSWORD=password - MYSQL_DATABASE=$your_db - MYSQL_USER=$your_db_user - MYSQL_PASSWORD=$your_db_password volumes: - ./data/:/var/lib/mysql ports: - "3306:3306"
.env file Your .env file is what Laravel uses when it starts up set up various things. The only real thing to change is your DB connection info. A full sample is shown below:
APP_ENV=local APP_KEY=$your_app_key APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://localhost DB_CONNECTION=mysql DB_HOST=db DB_PORT=3306 DB_DATABASE=$your_db DB_USERNAME=$your_db_user DB_PASSWORD=$your_db_password BROADCAST_DRIVER=log CACHE_DRIVER=file SESSION_DRIVER=file QUEUE_DRIVER=sync REDIS_HOST=127.0.0.1 REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp MAIL_HOST=mailtrap.io MAIL_PORT=2525 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null PUSHER_APP_ID= PUSHER_KEY= PUSHER_SECRET=
In order to do stuff with the database you should add the following
record to your local
# /etc/hosts 127.0.0.1 db
You should still install
npm and run
npm install from your local
machine so that you can do frontend stuff.
- .:/codeas a volume, this means that all of your local changes are immediately visible in the dockerized app.
docker-compose run app bashor
docker-compose run db bash
2016-11-30 09:00:56 ][ Tags: hacking php laravel
I've really been digging Laravel lately. Especially due to the wonderful documentation and amazing resources provided by Laracasts. Below are some notes on getting going on a local Ubuntu install. I am running Ubuntu 16.10 and these notes assume a fresh install.
sudo apt install php7.0 php7.0-zip php7.0-mbstring phpunit
curl -sS https://getcomposer.org/installer | php sudo mv composer.phar /usr/local/bin/composer
composer global require "laravel/installer"
Add the following to the end of your
# Add Composer to the PATH export PATH=$HOME/.config/composer/vendor/bin:$PATH
You can either source the
~/.bashrc file or open a new terminal
You can do this by running
laravel new test_project. Then go to the
directory where the new test_project is created with
Once you are in the new project directory install all local dependencies
composer install and then run it with
php artisan serve. I ran
into an issue right away that had to do with the APP_KEY. The error
manifested itself as:
The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths.
A great explanation is shown here but the steps to get a fully functional base install going are:
# Copy the .env.example file to .env cp .env.example .env # Generate App Key php artisan key:generate
Now if you run
php artisan serve you will see a fully running Laravel
app. Happy Hacking!
2016-11-15 18:23:37 ][ Tags: hacking php laravel
Yesterday I wrote about my first steps with Laravel and Homestead and complained about how I had some trouble getting started. It turns out this has nothing to do with Laravel and instead has to do with a Vagrant bug in the version that is shipped by default with Ubuntu 16.04 LTS.
vagrant up throws The following SSH command responded with a non-zero exit status error for Laravel Homestead
Installing Vagrant manually did the trick and everything worked like a charm. I am so impressed so far, the bootstrapped Laravel project is elegant, well structured, and beautiful by default. I am almost afraid to write any code because I will probably ruin it.
2016-11-14 21:50:20 ][ Tags: hacking php laravel
I'm checking out Laravel for the first time. I think they have a very nice web site, but slightly confusing documentation. First I tried to get composer working but the whole experience felt weird. Once I got it sorted out, I had some other issues with my local environment so then I went ahead and started to read about Homestead.
Laravel strives to make the entire PHP development experience delightful, including your local development environment. Vagrant provides a simple, elegant way to manage and provision Virtual Machines.
This was a bit more promising, since Vagrant makes everything dead simple. I was a bit surprised that the docs suggested creating a single Homestead box and sharing it across all of your Laravel projects since this is a practice that I have not seen before.
I went ahead and did what I usually do and create a Vagrant box for my specific project. It's been many years since I have written any "real" PHP, looking forward to seeing what Laravel has to offer.