Skip to content

Commit

Permalink
Readme update.
Browse files Browse the repository at this point in the history
  • Loading branch information
amostajo committed Jul 21, 2015
1 parent 053cebc commit d2aa920
Showing 1 changed file with 43 additions and 8 deletions.
51 changes: 43 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,16 @@ The power of **Composer** and **MVC** in your **Wordpress** plugins.

**Wordpress Plugin** (WPP) is a development template that can be used to create modern and elegant plugins. WPP comes with [Composer](https://getcomposer.org/) and [Lightweight MVC](https://github.com/amostajo/lightweight-mvc) framework.

[![Video tutorial header](http://s10.postimg.org/njeae0ogp/Videotutorialheader.jpg)](http://youtu.be/fXPNMH8vaMI)

- [Requirements](#requirements)
- [Installation](#installation)
- [Updating](#updating)
- [Usage](#usage)
- [Main Class](#main-class)
- [Hooks and Filters](#hooks-and-filters)
- [MVC](#mvc)
- [Config](#config)
- [Coding Guidelines](#coding-guidelines)
- [License](#license)

Expand Down Expand Up @@ -83,12 +86,6 @@ In order to prevent conflicts with other plugins using this template, it is sugg

To do this, type the following in the commando prompt:

```bash
php ayuco setup
```

This will ask you for a new name for yor plugin, you can always change it later with the following command:

```bash
php ayuco setname MyNewName
```
Expand Down Expand Up @@ -212,15 +209,25 @@ class Main extends Plugin
}
```

## MVC
Your `Main.php` can be accessed by other plugins or themes. If your namespace is `MyPlugin` a php variable called `$myplugin` will be created as an instance of `Main.php`.

Other naming examples:

```php
$awesomeplugin; // For AwesomePlugin

$bizapi; // For BizAPI
```

### MVC

**Lightweight MVC** is a powerfull and small MVC framework that comes with WPP.

To read more about the usar of *Models*, *Views* and *Controllers* we recommed to visit the packages main page:

[Lightweight MVC](https://github.com/amostajo/lightweight-mvc)

### Main class and MVC
#### Main class and MVC

**Lightweight MVC** engine is already integrated with `Main.php`, call the engine with `$this->mvc`.

Expand Down Expand Up @@ -255,6 +262,34 @@ Here is where the MVC files are located within your plugin:
|---> [views]
```

### Config

You can add your own config variables into `config\plugin.php` and access them within `Main.php`, like:

```php
// In config\plugin.php

'myapi' => [
'key' => 'jdsldjsfl12938nfk',
],

'url' => 'http://api.com',
```

```php
class Main extends Plugin
{
public function connect_api()
{
$key = $this->config->get('myapi.key');

$url = $this->config->get('url');

// MY CODE
}
}
```

## Coding Guidelines

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

0 comments on commit d2aa920

Please sign in to comment.