Install
This is the repository archive. It installs, but the folder name will carry the branch suffix and updates will not flow.
Install straight from GitHub with WP-CLI:
wp plugin install https://github.com/sinarkreasi/vira-code/archive/refs/heads/viraloka.zipA modern, modular WordPress plugin for managing and executing code snippets safely. Inspired by Fluent Snippet with enterprise-grade structure.
Description
Vira Code is a powerful code snippet manager for WordPress that allows you to create, manage, and execute PHP, JavaScript, CSS, and HTML snippets safely from your WordPress admin dashboard.
Features
- Multiple Snippet Types - Support for PHP, JavaScript, CSS, and HTML snippets
- Safe Execution - Sandbox PHP code execution with error handling and automatic rollback
- Execution Scope Control - Run snippets on frontend, admin, or both
- Modern Admin Interface - Clean, intuitive UI with syntax highlighting via CodeMirror
- REST API - Full REST API support for programmatic snippet management
- Safe Mode - Emergency switch to disable all snippets in case of errors
- Execution Logs - Track snippet execution with detailed logging
- Priority Control - Set execution order for your snippets
- Categories & Tags - Organize snippets with categories and tags
- Error Handling - Automatic error detection and snippet disabling on fatal errors
Why Choose Vira Code?
- Enterprise-Grade Architecture - Built with modern PHP 8.2+ standards
- PSR-4 Autoloading - Clean, organized codebase using Composer
- WordPress Coding Standards - Follows all WordPress best practices
- Secure - Proper sanitization, escaping, and nonce validation throughout
- Extensible - Custom hooks and filters for developers
- Well Documented - Comprehensive inline documentation
Developer Friendly
Vira Code provides numerous hooks and filters for extending functionality:
vira_code/snippet_saved- Fired when a snippet is savedvira_code/snippet_executed- Fired when a snippet is executedvira_code/safe_mode_enabled- Fired when safe mode is enabledvira_code/snippet_types- Filter available snippet typesvira_code/snippet_scopes- Filter available execution scopes
REST API
Access the REST API at /wp-json/vira/v1/ for:
- GET
/snippets- Get all snippets - GET
/snippets/{id}- Get single snippet - POST
/snippets- Create new snippet - PUT
/snippets/{id}- Update snippet - DELETE
/snippets/{id}- Delete snippet - POST
/snippets/{id}/toggle- Toggle snippet status
Installation
- Upload the
vira-codefolder to the/wp-content/plugins/directory - Run
composer installin the plugin directory (or upload with vendor folder included) - Activate the plugin through the 'Plugins' menu in WordPress
- Navigate to 'Vira Code' in your admin menu to start creating snippets
Requirements
- WordPress 6.0 or higher
- PHP 8.2 or higher
- Composer autoloader
Frequently Asked Questions
Is it safe to run PHP code snippets?
Vira Code includes several safety features:
- PHP code validation before execution
- Error handling with automatic snippet disabling
- Safe Mode to disable all snippets instantly
- Execution logs for debugging
However, always test snippets in a development environment first.
What happens if a snippet causes an error?
If a snippet causes an error:
- The error is logged with details
- The snippet is automatically marked as "error" status
- After multiple errors, Safe Mode may be auto-enabled
- You can use the emergency Safe Mode URL to disable all snippets
Can I use this on a production site?
Yes, but always:
- Test snippets thoroughly before activating
- Keep backups of your site
- Use Safe Mode if issues occur
- Monitor execution logs regularly
How do I enable Safe Mode in an emergency?
You can enable Safe Mode by:
- Visiting:
yoursite.com/wp-admin/admin.php?page=vira-code-settings&vira_safe_mode=1 - Using the toggle button in Settings
- Checking the Safe Mode checkbox and saving settings
Does this work with caching plugins?
Yes, but you may need to clear your cache after activating/deactivating snippets to see changes take effect.
Can I export/import snippets?
Currently, snippets are stored in the database. Import/export functionality may be added in future versions. You can use the REST API to programmatically backup and restore snippets.
Screenshots
- Snippets list with statistics
- Snippet editor with syntax highlighting
- Settings page with Safe Mode controls
- Execution logs view
Changelog
1.0.0
- Initial release
- PHP, JavaScript, CSS, and HTML snippet support
- Safe execution with error handling
- REST API integration
- Safe Mode functionality
- Execution logging
- Modern admin interface with CodeMirror
- Categories and tags support
- Priority-based execution order
1.0.1
- Fix bug clear logs
- Optimize code
1.0.2
- Add custom value log entries
1.0.3
- Add conditional logic
Upgrade Notice
1.0.0
Initial release of Vira Code. Requires PHP 8.2+ and WordPress 6.0+.
Development
Vira Code is actively developed. Visit our GitHub repository for the latest updates, to report issues, or to contribute.
Credits
- Inspired by Fluent Snippet
- Built with WordPress coding standards
- Uses CodeMirror for syntax highlighting
Support
For support, please visit our website or use the WordPress.org support forums.
License
This plugin is licensed under the GPL v2 or later.
Copyright (C) 2025 Viraloka
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.