Visitar URL original
Learn Python as a PHP Developer | From PHP to Python
Originally a book, now an online course
v3

From PHP to Python

You're almost a Python developer. You just don't know it yet.

PHP 8.5+
Python 3.15+

What you write today…

Copied
Highlighting...
$names = ['Inès', 'Ada', 'Sam', 'Mike'];

// ['INÈS', 'MIKE']
array_values(array_map(
    fn($name) => mb_strtoupper($name),
    array_filter(
        $names,
        fn($name) => mb_strlen($name) > 3
    )
));

…what you'll write soon

Copied
Highlighting...
names = ['Inès', 'Ada', 'Sam', 'Mike']

# ['INÈS', 'MIKE']
[name.upper() for name in names if len(name) > 3]
58 chapters written for professional developers, no filler
Go deep into Python, not just its syntax
Every concept mapped to the PHP you already know, shown side by side
One-time payment, all future updates included
30-day guarantee: money-back promise
Choose between 60 syntax highlighting themes
By purchasing, you accept our terms.
I had the honor of reading a draft of this book. It's been extremely helpful. Most Python books and courses start with the basics of programming; this book assumes you have experience with PHP so you can dive into the relevant differences really quickly. Recommended!

Not ready yet?

Start with 7 free chapters. No account or credit card required.

Read the free chapters

Learn Python the smart way

Start from what you know

Take your existing PHP knowledge and map it directly to Python. You learned so many things over the years (variables, loops, functions, objects, etc.). Why not reuse that knowledge?

My promise to you: this course is the fastest way to learn Python you'll find, if you already know PHP.

Side-by-side code

Whenever relevant, PHP and Python code are shown side by side so you can understand the differences at a glance.

Both languages are displayed in separate, syntax-highlighted code blocks (you can even choose your favorite color theme for each!).

Stop wasting time

You hate wasting your time? I hate wasting yours too.

I keep things concise: I avoid unnecessary sentences and filler. Every paragraph, every example is there for a reason.

Concise doesn't mean shallow: we go very deep into many topics.

It is brilliant. I think you've done a stellar job. No criticisms.
Christian Coyle

Python features

What makes Python truly powerful is its versatility across domains. Learn Python once, apply it everywhere.

Scripting & CLI

Automate system administration tasks, DevOps workflows, and batch processing. Python's simplicity makes it perfect for writing maintainable automation scripts.

Web Development

Build web applications with frameworks like Django, Flask or FastAPI. The core skills you learn here directly apply to web development.

Huge Ecosystem

Access PyPI's millions of packages for any use case.

Data Science & AI

After finishing this course, you could explore machine learning with NumPy, pandas, and scikit-learn. Python's language foundation transfers perfectly to data science.

Python has a different philosophy that brings interesting solutions to common problems. Explore some features that make Python unique.

Context Managers

Context managers provide a clean and efficient way to do always ensure that some actions will be done even if an error occurs. This is very useful to manage resources like file handling, database connections, and network sockets.

Copied
Highlighting...
with open('example.txt', 'r') as file:
    data = file.read()

# The file is automatically closed after the `with` block

Operator overloading

Python allows you to define custom behavior for standard operators (like +, -, *, etc.) in your classes. This feature, known as operator overloading, can be very useful to build and use Value Objects.

Copied
Highlighting...
class Money:
    def __init__(self, amount):
        self.amount = amount

    def __add__(self, other):
        return Money(self.amount + other.amount)

# Usage
m1 = Money(100)
m2 = Money(50)

# Money(150)
m3 = m1 + m2  # Uses the overloaded + operator

Comprehensions

Python's comprehensions are an elegant concise way to create lists, sets, and dictionaries, replacing our good old array_map and array_filter.

Copied
Highlighting...
numbers = range(1, 11)

# Create list of squares
squares = [x**2 for x in numbers]

# Filter and transform
even_squares = [x**2 for x in numbers if x % 2 == 0]

# Create a dict
squares_dict = {x: x**2 for x in numbers}

Slicing

Any sequence (list, tuple or string) can be sliced with a compact syntax.

Copied
Highlighting...
letters = ['a', 'b', 'c', 'd', 'e', 'f']

# 'f': the last item, no length needed
letters[-1]

# ['b', 'c', 'd']: from index 1, up to (excluding) 4
letters[1:4]

# ['a', 'b', 'c', 'd']: everything but the last two
letters[:-2]

# ['a', 'c', 'e']: every second item
letters[::2]

# 'nohtyP': a negative step reverses the sequence
'Python'[::-1]

Decorators

Decorators allow you to modify the behavior of functions or classes in an elegant way. They are a powerful way to implement concerns like logging, access control, or caching.

Copied
Highlighting...
import time

def timer(func):
    def wrapper(*args, **kwargs):
        start = time.perf_counter()
        result = func(*args, **kwargs)
        elapsed = time.perf_counter() - start
        print(f"{func.__name__} took {elapsed * 1000:.2f} ms")

        return result

    return wrapper

@timer
def count_words(filename):
    with open(filename) as file:
        return len(file.read().split())


# prints "count_words took 42.75 ms"
count_words('book.txt')

Python is the new black

I have 15 years of experience in PHP dev and needed to learn Python for a hiring test, this book was really made for people like me.

Python has become one of the most valued skills in the job market. Whether you want to boost your career, gain higher salaries, or stay competitive in a rapidly evolving tech landscape, Python is the skill that opens doors.

All the data points below consistently highlight Python's immense popularity and growth in the developer community.

#2

language on GitHub, growing 48% year over year

GitHub Octoverse 2025

GitHub's 2025 Octoverse

GitHub's 2025 Octoverse survey reveals Python ranks #2 among all programming languages, with 2.6 million active contributors and a remarkable 48% year-over-year growth rate.

Python remains dominant in AI and data science, establishing itself as the essential language for exploratory AI work through widespread Jupyter notebook adoption.

#4

most used language by professional developers

Stack Overflow 2025

Stack Overflow Survey 2025

The Stack Overflow Survey shows the languages developers use most frequently. Python ranks 4th among professional developers, right after JavaScript, HTML/CSS, and SQL.

Python adoption grew in 2025: After more than a decade of steady growth, Python's adoption has accelerated significantly. It saw a 7 percentage point increase from 2024 to 2025; this speaks to its ability to be the go-to language for AI, data science, and back-end development.

Stack Overflow Survey 2025 - Most Popular Technologies (Languages)

Rank Language Usage
1 JavaScript 66%
2 HTML/CSS 61.9%
3 SQL 58.6%
4 Python 57.9%
5 Bash/Shell 48.7%
6 TypeScript 43.6%
7 Java 29.4%
8 C# 27.8%
9 C++ 23.5%
10 PowerShell 23.2%
11 C 22%
12 PHP 18.9%
#2

language PHP developers want to switch to

JetBrains State of PHP 2025

JetBrains: The State of PHP 2025

According to JetBrains’ State of PHP 2025 survey, Python is the second most desired language for developers looking to switch next year, right behind Go.

More than 10% of PHP developers said they’re interested in learning Python.

Are you one of them?

Do you plan to adopt or migrate to other languages in the next 12 months? If so, which ones?

Language / Option Percentage
No, I'm not planning to adopt or migrate 58%
Go 15%
Python 11%
Rust 7%
TypeScript 7%
Kotlin 6%

Table of Contents

7 of the 58 chapters are free, including Decorators and Testing with unittest.

Free

Introduction

Free

Before we start

Free

Language syntax

Free

Data types

Free

Positional and keyword arguments

Premium

Unpacking

Premium

Comprehensions

Premium

Local and global variables

Premium

Classes and objects

Premium

Objects, objects… objects everywhere!

Premium

== and is explained

Premium

Imports, modules and packages

Premium

PEP ?

Premium

Exceptions

Premium

Working with strings

Premium

Datetimes

Premium

Match case

Premium

Working with regexes

Premium

Magic methods

Premium

Lambdas

Premium

Documenting and debugging your code

Free

Decorators

Premium

Context managers

Premium

Generators

Premium

Managing dependencies with pip

Premium

Let's bring some light with uv

Premium

Managing multiple Python versions with uv

Premium

Monkey patching

Free

Testing with unittest

Premium

Testing with pytest

Premium

Type hints

Premium

Enums

Premium

Interacting with the filesystem

Premium

Working with environment variables

Premium

Logging

Premium

Template-strings

Premium

Interacting with the CLI

Premium

Walrus operator

Premium

DTOs in Python

Premium

Mixins

Premium

Interfaces

Premium

Serializing

Premium

Standard lib and interesting modules

Premium

Tooling and linting

Premium

The long-running shift

Premium

HTTP Clients

Premium

Interacting with databases

Premium

SQLAlchemy

Premium

Publishing a package on PyPI

Premium

Concurrency: Theory and Processor

Premium

Concurrency: Threading

Premium

Concurrency: Multiprocessing

Premium

Concurrency: AsyncIO

Premium

Async in practice

Premium

Web frameworks

Premium

WSGI and servers

Premium

Python culture

Premium

Lexicon

The book is amazing - it simply fit in with my needs perfectly. I've been doing PHP for 25 years, as well as Javascript, Typescript, Kotlin. I wanted to get a feel for Python and reading your book has made the entire process super comfortable. It is so well written, but the real gold is how you've made the right assumptions about what an experienced PHP dev will already know. The balance is very well calculated.
Ben Roberts

The Author

Yann Rabiller

Yann Rabiller

Backend developer

I’m a professional backend developer and author, and I live in Paris, France. I have over 10 years of experience building robust, scalable web applications and worked extensively with Symfony, Laravel, and Django.

I'm always happy to discover new technologies and approaches, and I love teaching what I know. I'm absolutely convinced you can learn anything quickly and efficiently as soon as you have the right teacher.

Frequently Asked Questions

Do I need an account to read the free chapters?
No. The free chapters are open to everyone: no signup, no credit card. We verify your email with a one-time code when you buy the course or sign in to a course you already own.
I have already bought the book on Gumroad. Do I need to pay again?
No, for you the course is free, of course. Just use the same purchase email you used on Gumroad to access the course.
What's wrong with PHP?
I still work a lot with PHP and enjoy it. I am not saying Python is a better language. They both have their pros and cons. The goal of the course is to make you a proficient Python developer and to widen your professional opportunities: not to criticize PHP.
What if I don't like the course?
If you don't like the course, you can ask for a refund within 30 days by sending an email to hello@fromphptopython.com.
Which payment provider do you use?
This course uses Polar. You can safely pay with your credit card, Apple Pay or Google Pay.
Which are the last versions of PHP and Python this course covers?
This course covers up to PHP 8.5 and Python 3.15.
What if I have a technical problem about the website?
Drop an email to hello@fromphptopython.com.

You've read this far.
Time to write some Python.

Start with the 7 free chapters. No signup, no credit card. When you're convinced, unlock all the chapters once and for all.

Start reading