A skelton for your slim app
- install with composer. Your PHP package manager.
composer create-project the94air/slimo [Project Name]
- And for using webpack (laravel-mix) just run
npm install
- Have fun!
You can browse these links to find out more about each part of this skeleton
- Slim framework
- Laravel ORM (Eloquent) for communicating with the database.
- Dotenv for loading environment variables (.env).
- Twig for PHP template engine.
- Slim-Csrf for CSRF protection.
- SlimValidation & Respect\Validation for forms validation.
- Laravel Mix for assets compiling with wepack.
- swiftmailer for sending emails.
For that you will be able to add your configurations to the .env
file.
# Using SMTP
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
MAIL_USERNAME=example@gmail.com
MAIL_PASSWORD=secret
MAIL_ENCRYPTION=tls
# Or using Sendmail server
MAIL_DRIVER=sendmail
MAIL_SENDMAIL_PATH='/usr/sbin/sendmail -bs'
And after that you will be able to access the $mailer
from your Routers and Controllers.
class MailController extends Controller
{
public function index(Request $request, Response $response, $args)
{
$mailer = $this->mailer;
// Create a message
$message = (new \Swift_Message('Wonderful Subject'))
->setFrom(['john@doe.com' => 'John Doe'])
->setTo(['receiver@domain.org', 'other@domain.org' => 'A name'])
->setBody('Here is the message itself');
// Send the message
$result = $mailer->send($message);
// returns `int(2)` on success
var_dump($result);
}
}
This package is forked from slender package thanks to Alex Garrett with more additional and useful packages. Feel free to add your own feature from the open source universe (Make a pull request).
This software does not have a license. All used packages has it's own license. And BTW... Laravel is a trademark of Taylor Otwell.