Laravel, WordPress

Migrate from WordPress to Laravel – Part 1

Assalamualaikum / Hi,

I’ve been using WordPress, since 2012 – 5 years, of service. I think it’s time to migrate to another platform – Laravel. I’ve been reading how murze.be did.

Basically, I got the idea how he did. But, as my sense of explorer, want to learn something new, I read few more articles, packages available out there for migrate from WordPress to Laravel.

I ended up with my own solution.

The idea – use the WordPress REST API.

Of course, I need to prepare my database schema, but I left that part later. What’s important is to grab all the contents from my blog – posts, pages, comments, media, tags, categories and users(since i’m the only author, I don’t have to fetch the user).

Here what I did:

Create the service to call WordPress REST API.

Create an artisan command to fetch all contents.

Do register the artisan command in `Kernel.php`

Then create a `wp` directory in `storage` directory.

So, what I need to do, just call php artisan import:wp https://blog.nasrulhazim.com and I will get as following, store in storage/wp in JSON Pretty Format.

And that’s it for Part 1.

Next, I need to grab all the media, download it to my storage directory.

See you guys on next post.

2 thoughts on “Migrate from WordPress to Laravel – Part 1

Leave a Reply

Your email address will not be published. Required fields are marked *

fifteen + fifteen =