Hello Masonite Newsletter #4
We're back. A lot of things happens since our last newsletter. But first I want to wish you an amazing work and career year!
Now, let's dive into this year's first Hello Masonite newsletter.
Masonite 3 has been released and it does have a lot of great stuff! Masonite 3 continues the improvements made so far in the framework by introducing a brand new ORM, new presets, and a variety of other bug fixes and improvements. THIS IS MASONITE THREE!
Masonite ORM, an extremely easy way to communicate with a database
Masonite ORM is the replacement for Orator built from complete scratch. It supports MySQL, Postgres, SQLite, and Microsoft SQL Server and most importantly an Active Record style ORM.
Models can perform common database operations without coding SQL queries:
Make sure to update the import path in the model
# app/User.py
from masoniteorm.models import Model
class User(Model):
pass
And perform a model querying:
from app.models import User
users = User.where('active', 1).get()
Masonite ORM has a lot of great features. And you can learn more here https://orm.masoniteproject.com/ contribute to the codebase here https://github.com/MasoniteFramework/orm
Single Action Controllers
Single Action Controllers are controllers that do one thing and one thing only. - Dries Vints
By defining a single __call__ method within the controller, you have a so-called Single Action Controller, a dedicated controller to one action.
ROUTES = [
Get('/posts/@post', 'PostController')
]
class PostController(Controller):
def __call__(self):
pass
Tailwind and Vue3 presets
Frontend presets give developers a quick, convenient starting point for building their applications. You can add Vue 3 to your application using this command python craft preset vue3 or Tailwind using python craft preset tailwind2.
Craft
Craft the command-line utility that comes with Masonite is extensively used for setting up migrations, route listings, queueing, class creations, and other related tasks. You might need to add python before calling craft. For example:
craft controller Dashboard
becomes
python craft controller Dashboard
Those are just some of the marque additions, but Masonite 3 is also packed with minor changes, fixes, and upgrades. Just some I’d call out: HTTP Header Prefix, Status Codes, New Providers, Queue Table columns, etc.
Thanks to Joseph Mancuso and other contributors (Marlysson Silva, Samuel Girardin) who keep working on making Masonite better.
Like what you read? Feel free to share! Make sure to follow us on Twitter to know when my next post is out.
Have a great week,
Please be safe and take precautions.... and wash your hands.
From all of us at Hello Masonite.