Download the PHP package media-store-net/wp-mvc-core without Composer

On this page you can find all versions of the php package media-store-net/wp-mvc-core. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-mvc-core

WP MVC Core (For Wordpress plugins and themes)


This is a forked version of amostajo/[email protected]

Lightweight MVC is a small framework that adds Models, Views and Controllers to your custom Wordpress plugin or theme.

Lightweight MVC utilices existing Wordpress functionality preventing from overloading the already heavy loaded Wordpress core.

This framework was inspired by Laravel to add the MVC design pattern to Wordpress development in an efficient, elegant and optimized way.

Requirements

Installation

Add

to your composer.json. Then run composer install or composer update.

NOTE If you are not using composer, you can download the ZIP but will need to include the files manually since not autoload will be generated.

Configuration

Your project needs to store somewhere your Models, Views and Controllers, and Lightweight MVC must know where.

Create these as folders, like this:

Then in your functions.php or plugins.php file set these at the very beginnning, like:

Usage

Models

In Lightweight MVC, a Model at the end is just a type of Wordpress post. Store your models at the models folder.

Here is model example:

With just that, you will be able to do this:

Aliases

The model will let you add aliases to post attributes, meta values and event custom functions.

When adding aliases to properties you can do things like this:

You can extend the attributes of a post with the meta table, the model does this seamlessly when adding aliases with meta_ prefix:

Usage:

Sometimes you might need to add some logic to your attributes, you can accomplish this by adding an alias for a function using the func_ prefix:

Usage:

Aliases fields are included when casting the model to arrays, json or string.

Types

As mentioned before, a model is a post type. Once a post type has been registered by you plugin or theme, you can create a model for it.

In the following example a new post type books has been created to handle book records:

With just that, books can be used like this:

Views

This is the templating mini-engine of Lightweight MVC.

Views are PHP files whose content is HTML most of the time. PHP tags should only be used to echo values from variables passed by.

Here an example of a view that displays a book object from the example above:

NOTE: There is no PHP logic in the view, just pure HTML, perfect for the designer to handle. Logic is placed in the controller.

You can place your views as please within the views folder. In example, let's assuming that the view file from above is named profile.php, you can place it in a path like this:

The key locator for this view within the engine will be:

books.profile

NOTE: If this view is located inside a plugin, you can add the same hirachy in any theme to customize the view with the theme's styles. Lightweight MVC will give priority to the view located in the theme.

Something like this:

Controllers

Controllers are used to create handle any business logic and algorithms.

In the following example, we will use a controller to display the book profile.

Engine

Once you have everything in order, you can use the framework as following (using the same book example):

Helpers

This package comes with a request class helper, to retrieve values from GET, POST or WORDPRESS' query_vars:

Third value will clear the source value, great to prevent loop wholes with NONCE:

Coding Guidelines

The coding is a mix between PSR-2 and Wordpress PHP guidelines.

License

WP MVC Core is free software distributed under the terms of the MIT license.


All versions of wp-mvc-core with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package media-store-net/wp-mvc-core contains the following files

Loading the files please wait ....