Framework for WordPress plugin development.
It is recommended to use Kathamo Generator to generate your custom skeleton of this Framework
If make commands work in your OS then just need to run make setup
.
Otherwise follow this process:
composer install
npm install
npm run dev
If you want to enqueue unminified assets then change HOWDY_DEV_MODE
to true
for loading unminified assets.
TailwindCSS support also added. To watch changes npm run tailwindcss:admin
or npm run tailwindcss:public
On development environment, two apis are available for better debugging experience.
dump($data); // debug data
dd($data); // debug data and die.
A trait for singleton is available. You can use it for creating single class instance.
For example: check Core
we have used SingleTon
, then created class instance in plugin.php > Core::getInstance()
.
Set rest api base url, namespace, version in HttpKernel
class
/**
* GET request
*
* @param (string) $route
* @param (array) $arguments
* @return \Howdy\Core\Lib\Response
*/
$response = HttpKernel::get( 'post',
[
'timeout' => 25
]
);
/**
* POST request
*
* @param (string) $route
* @param (array) $arguments
* @return \Howdy\Core\Lib\Response
*/
$response = HttpKernel::post( 'authenticate',
[
'body' => [ 'token' => 'sdlfepoagdhwt3543sfes' ]
]
);
HTTP requests return \Howdy\Core\Lib\Response
object. This object has apis as below.
getBody() // json decoded body of the response
getBody(false) // json encoded body
getStatusCode() // status code of the response
getMessage() // response message
getHeaders() // get response headers
dump() // debug response
$response = HttpKernel::post( 'authenticate',
[
'body' => [ 'token' => 'sdlfepoagdhwt3543sfes' ]
]
);
if ( $response->getStatusCode() === 200 ) {
// Do something
}
$response->dump(); // debug response data
Deploy to WordPress org plugin repo by creating a tag and push it on Github.
For doing so, just go to your plugin Github repo Settings > Secrets
and create tow variables as below. Then change SLUG
in .github/workflows/diploy.yml
, here add your plugin's WP ORG slug.
That's it, now whenever you push a tag on Github the plugin will be automatically deployed to WP ORG plugin repo. It remove all development files that are not required in production. If you want to change which development files to remove than just modife .distignore
WP_SVN_USER <your svn user>
WP_SVN_PASS <your svn password>