LaraflareDocsFrameworkPackagesReleases13.x

Docs / Prologue / Upgrade Guide

Upgrade Guide

Upgrading Between Releases

There is nothing to upgrade from yet. When a release changes something an application has to change, its section is added here, newest first.

Moving From PHP

An application written in PHP on Laravel is not upgraded, it is moved. Because laraflare keeps the same classes, methods, routes, configuration and messages, the application keeps its shape: app/Models/Post.php becomes app/Models/Post.ts, and its database, its users' passwords and its encrypted data stay as they are.

Moving the Code

The code is moved by your agent, one resource at a time, with the type checker and the moved tests run after each: see Moving an Existing Application.

What Carries Over

The database. The new application uses the same database, tables and rows. Point its DB_* settings at the existing MySQL, MariaDB, PostgreSQL or SQLite database. Each moved migration keeps its file name, so npx artisan migrate finds nothing to run against a database the PHP application migrated; run npx artisan db:generate --schema once to write the database/schema files the models read. On Cloudflare Workers the database is D1, which is SQLite: the rows are exported from the old database and imported into D1 once.

Passwords. The bcrypt hash driver, the default, writes and checks the same $2y$ hashes PHP does, so every user signs in with the password they already have. A hash made with a different number of rounds than BCRYPT_ROUNDS is rehashed the next time its user signs in, as it is in PHP.

Encrypted data. Copy the application's APP_KEY (and any APP_PREVIOUS_KEYS) into the new .env. Columns that use the encrypted casts, and anything encrypted with Crypt::encryptString or Crypt::encrypt, decrypt as they are: Crypt.decrypt() reads a value PHP serialized as well as the JSON laraflare writes.

Switching Over

  • Let the PHP application's queue empty before switching: a job queued by PHP is a serialized PHP object, which laraflare cannot run. Retry or clear its failed jobs first, for the same reason.
  • Clear the cache. Cached values written by PHP are serialized PHP and are not read back.
  • Expect users to sign in again once: sessions are not carried over.
  • Keep the same APP_URL, routes and route names, so links and bookmarks keep working.
Adapted from Laravel's documentation, Copyright (c) Taylor Otwell, used under the MIT License.