DEV Community

Cover image for PHP Laravel Developer who wants to learn Python quickly? You have to look at Masonite.
Eric The Coder
Eric The Coder

Posted on

PHP Laravel Developer who wants to learn Python quickly? You have to look at Masonite.

If you are familiar with PHP and Laravel and would like to learn Python, it is good to know that there is a Python web framework out there that is very similar to Laravel: Masonite.

Masonite is a Python MVC web framework which is very close to Laravel. So in a few hours you will be able to develop your own Python web application :-)

Here is the documentation and the starting instructions: https://docs.masoniteproject.com/

There are also some getting started videos: https://masonitecasts.com/timeline/getting-started/introduction

Here are some examples of Python Masonite.

Routing


ROUTES = [
    Get('/contacts', 'ContactsController@index').name('contacts.index'),
    Post('/contacts', 'ContactsController@store').name('contacts.store'),

]
Enter fullscreen mode Exit fullscreen mode

Controller

def index(self, view: View, request: Request):
    contacts = Contact.all()
    return view.render('contacts.index', {'contacts': contacts})

Enter fullscreen mode Exit fullscreen mode

Migrations

def up(self):
    with self.schema.create('Contacts') as table:
        table.increments('id')
        table.string('last_name')
        table.string('first_name')
        table.timestamps()

Enter fullscreen mode Exit fullscreen mode

As you can see your Laravel knowledge will be very useful :-)

If you have any questions do not hesitate.

For those who like the concept and want to encourage the developer please donโ€™t hesitate to give a little star for Masonite on Github: https://github.com/MasoniteFramework/masonite

Good development!

Top comments (2)

Collapse
 
insolita profile image
Insolita

Wow! It really has a very similar concept. Even ORM!

Are you a maintainer? Have you an experience for use it in production?
I'm interesting - what about performance in comparison to the original Laravel and Django? As a fact, Laravel is a heavy PHP framework.

Collapse
 
insolita profile image
Insolita

I saw github.com/the-benchmarker/web-fra... the results of the Masonite looks better than many other - flask, django, laravel... But benchmark case is far from a real application