Skip to content

moiseh/wp-magic-crud

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magic admin CRUD plugin for WordPress

This plugin allows a developer to create fast CRUD's for WordPress admin panel. It was made for the author current CRUD needs, that may (an probably) be very different of yours.

Overview

  • It's made to use with custom business database tables, does not use WP Post, Tags nor media library and similar WP API stuff
  • It's made to create generic CRUD's with little effort, priorizing convention over configuration. Not recommended to create complex admin panels
  • Generates automatically the database structure (can be enabled or disabled)
  • Uses WP_List_Table WordPress API to create the listings, so the result will be similar of the WordPress Posts and Pages admin sections
  • Stuff included: Menus, Actions, Bulk Actions, Pagination, Validation, Complex relationship fields
  • Allow full REST operations including data pagination and Actions executing
  • CRUD definitions are defined by default using JSON files and uses low code / no code concepts
  • Some behaviors like dynamic SQL queries can be customized using PHP callback functions
  • CRUD objects are strictly mapped from JSON/arrays to PHP objects using Cweiske JsonMapper library
  • Database operations are mainly operated using Laravel Eloquent Wrapper for WordPress library
  • Actions operations and other background jobs heavily uses WooCommerce ActionScheduler library

Installation Steps

1. Require the Package

Add wp-magic-crud plugin package inside your wordpress/wp-content/plugins folder with the following command:

git clone https://github.com/moiseh/wp-magic-crud.git

Alternativately you can download using the following link: https://github.com/moiseh/wp-magic-crud/archive/master.zip

2. Enable this plugin in your WordPress admin panel

Built-in field types

  • belongs_to (references another entity)
  • boolean
  • checkbox_multi
  • datetime
  • decimal
  • email
  • float
  • has_many (creates multi-selectable checkboxes)
  • integer
  • one_to_many (creates a repeatable table linking to another entity)
  • select
  • text
  • textarea
  • virtual (useful for displaying raw SQL expressions when retrieving or paginating data)

Built-in action types

  • simple (simple actions without input data for quick and no cpu-intensive task executions)
  • fieldable (actions that requires user input data from UI form or REST payload before execution)
  • background (cpu-intensive or time-consuming tasks that run as background jobs using ActionScheduler library)

How to use

You can implement your custom plugin to create CRUD entities or just use it as a library embed in your plugin. A full example of how to use can be found in the following repository: https://github.com/moiseh/wpmc-example.git

F.A.Q.

1. Why another admin CRUD builder?

I didn't found any ready to use solution that fit exactly my needs. With this i can use or embeed a lightweight API to generate CRUDs in my another plugins or create some SAAS application.

2. This is a ready to use for production?

It was working and tested to use for my personal plugins, but is not heavily tested and backwards compatibility is not guaranteed. You can fork the project if it's useful to you and modify whatever you want. This was initially inspired in WP Basic Crud plugin.

Hook examples

Define Entity objects load cache for 5 minutes

add_filter('wpmc_entity_cache_time', function(){ return 300; });

About

Magic admin CRUD generator for WordPress

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages