I am happy to announce the launch of KoaWP, an object-oriented WordPress starter plugin designed to help you kickstart your next WordPress plugin project. KoaWP follows the MVP approach and comes with its own namespace and composer support, making it easy for you to get started.
With KoaWP, you get a well-organized file structure that includes a “controllers” folder for managing your plugin functions, an “app” subfolder for global features and bootstrapping, a “languages” folder for the .pot file, a “tests” folder for PHP Unit, and a “views” folder to manage all template files.
Here are some tips to help you get started with KoaWP:
- Develop with debugging on to identify and fix errors promptly.
- Prevent direct access to your files to avoid PHP errors.
- Sanitize all data collected from users to avoid vulnerabilities.
- Escape output data to prevent XSS vulnerabilities.
- Use nonces to verify requests and prevent CSRF attacks.
- Use $wpdb for database queries to reduce the risk of SQL injection attacks.
- Use WordPress’ WP_HTTP class and wrapper functions to avoid using cURL directly.
- Prevent unauthorized access by checking user capabilities.
- Use native WordPress functions and libraries to keep your code lean and secure.
KoaWP is available for download on GitHub, so head over and start coding!