Laravel and WordPress Series--Integrated Laravel and WordPress extension Package Daquan

Source: Internet
Author: User
Tags wordpress database
WordPress is one of the world's most popular open source applications, according to statistics, 20% of the world's Web site based on WordPress development, using WordPress management background, publishing articles, add menus, upload pictures very convenient, So sometimes we want to use WordPress backstage to build the app, but the front desk we want to have more custom space, can be like laravel as a variety of flexible development, the good news is that on GitHub, there are a lot of WordPress background +laravel foreground extension package , let's get a glimpse of it:

WordPress Corcel

Corcel uses the Laraveleloquent model to get the content directly from the WordPress database, and after the installation is complete, you can get the model data by following the Laravel style code:

All published posts$posts = post::p ublished ()->get (), $posts = Post::status (' Publish ')->get ();//A specific Post $post = Post::find (31);

The extension package supports articles, article types, labels, pages, categories, and attachments, but the extension package is still in development and is not released in the official version.

Wordpresstolaravel

Wordpresstolaravel is used to synchronize blog data from WordPress.com, which is designed to run by Laravel Scheduler to dispatch tasks, automatically downloading and importing article data to the local database.

After Setup is complete, you need to write model classes, controllers, and view code that match your database, and the benefit of using wordpress.com is that it automates the upgrade of WordPress and uses CDN technology to publish content through websites, mobile apps, and desktop apps.

The downside is that this extension pack can only be used to publish article data, not classification and tagging.

WP Eloquent

WP eloquent is an expansion pack for creating a press data table model that encapsulates WOR, including post, Comment, post Meta, user, and user Meta model classes. After the installation is complete, the following are examples of use:

Use Wedevs\orm\wp\post as Post; Post::type (' page ')->get () post::status (' Publish ')->get () post::type (' page ')->status (' Publish ')->get ( )

WP eloquent can also work with Laravel Debugbar and will not create redundant database connections.

Laravel-wp-api

LARAVEL-WP-API integrates the WordPress JSON REST API, which can be used to query data via alias Wpapi after installation:

$post = Wpapi::p ost ($slug), $catPosts = Wpapi::category_posts ($slug, $page);

other ways to integrate WordPress and Laravel

Of course, the integration of WordPress and Laravel is not limited to these several expansion packs, here are some articles and tutorials on how to manually integrate both:

    • Wordplate builds and uses WordPress as a dependency based on laravel and symfony components
    • Integrated WordPress and Lumen
    • Set up the Laravel API for integrated WordPress backend
    • Integrated Laravel 4+ Eloquent and WordPress

As you can see, there are a lot of ways to integrate WordPress and Laravel, depending on your needs and goals, anyway, there's always one for you ~

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.