Access all articles in sprocket icon.
Published October 23, 2016 by Bill Keck.
make:social-app command released for Foundation Maker
I pushed through the weekend and was able to get the make:social-app command done for Foundation Maker. For anyone unfamiliar with it, Foundation Maker is a free package that currently adds 19 new artisan commands.
Installation via composer is a snap. Just run the following from the command line:
composer require evercode1/foundation-maker
Then add the following to the providers array in config/app.php:
php artisan list
So if you’ve been following this blog, you know that Foundation Maker is a code generator and you can check out the docs for a full list of commands.
For now, we are going to focus on make:social-app.
The make:social-app command is intended for use with a fresh install of Laravel. It will overwrite many files, and therefore is not to be used with an existing project.
Also note, that the application the command will produce is dependent on the following packages being installed:
And obviously, you would have to have Foundation Maker installed as well. If you have read my book, you will be familiar with the code this command produces, we cover it extensively throughout the book. Again, you can check the docs to get an idea of all the files it creates for you.
The social app that Foundation Maker creates handles social authentication with one-click through facebook, but you do need to set up your facebook app and grab the credentials and paste them in your .env file for it to work. It takes less than a minute, if you have done this before.
Then all you need to do is run from the command line:
php artisan migrate
Then, if you have already done so, run the following from the command line:
And then of course, run:
I built this command for a number of reasons. I felt that having an artisan command generate the code and locate it where I would normally put things was a big advantage over setting up a package that would reside in the vendor folder. I like having just one location for my controllers, etc.
Another advantage is that I’m forced to keep the templates up-to-date. If I pulled down an archived template, for example, I wouldn’t be getting the latest version of Laravel. Sure, you can run composer update, but that doesn’t update the files that reside in your app folder.
And finally, I felt it was important to be able to seamlessly integrate the other commands that Foundation Maker provides. For example, one of those commands, make:exception, allows me to create exceptions and their corresponding views with a single command. The social-app template has a Handler.php file that makes it easy for me to integrate the new exceptions.
Anyway, I’m happy to get this command released. As a production note, I’ve also added more bonus material to Laravel 5.3 For Beginners to cover the new command.
Thanks to everyone who has and is supporting my work. I don’t have a donate button, but if you would like to contribute, you may do so by buying one of my books, Laravel 5.3 For Beginners. I would really appreciate it. Shares, comments, likes, and book reviews are also greatly appreciated. See you soon.