plasticstudio / dev-tools
Development tools for SilverStripe
Installs: 2 006
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Language:Scheme
Type:silverstripe-vendormodule
pkg:composer/plasticstudio/dev-tools
Requires
README
Adds additional functionality to assist in developing SilverStripe websites.
Dependencies
- SilverStripe 3.1+
- Betterbuttons
Features
- Performance of page loads
- Visualisation of current site state (DEV/TEST/LIVE)
- Admins can emulate any other user
IconSelectFieldto use icon libraries within the CMS- Automatic redirection from development domains, when in LIVE mode
LogJamlogging to append system error log- BugHerd integration
Installation
- Add to your composer requirements
composer require jaedb/dev-tools - Edit your theme's
templates/Page.sstemplate and add$DebugToolsimmediately before the</body>tag - Run /dev/build?flush=1
- Toggle debug tools by turning your site to DEV or TEST modes (disabled on LIVE sites for obvious reasons)
- Set the site's BugHerd project key in
config.yml. See config/dev-tools.yml for an example.
Usage
Primary domain redirection
When you set your SS_PRIMARY_DOMAIN property on a live website, we automatically redirect to this primary domain. This avoids the need for bloated .htaccess redirections and allows control at the environment level.
- Set your preferred domain in
_ss_environment.php - Consider whether you want http vs https, and include this in your domain (but exclude trailing slash!).
- Example:
define('SS_PRIMARY_DOMAIN', 'https://plasticstudio.co.nz');will redirect http://www.plasticstudio.co.nz/some-section/subpage to https://plasticstudio.co.nz/some-section/subpage. - To completely disable this functionality set
disable_primary_domain_redirection: truein your project'sconfig.yml
Debug Tools
- Manage the visibility of the Debug Tools from within the CMS, under Settings
- Manage ability to Emulate users, also under Settings
IconSelectField
- Set your
$dbfield to typeIcon(eg'PageIcon' => 'Icon') IconSelectField::create($name, $title, $iconFolder)$nameis the database field as defined in your class$titleis the label for this field$iconFolder(optional) defines the directory where your icons can be found. Defaults to/site/icons.- Use your icon in templates as you would any other property (eg
$PageIcon). If your icon is an SVG, the SVG image data will be injected into the template. To prevent this, you can call$PageIcon.IMGinstead to enforce use of<img>tags.
LogJam
LogJam::Log($message, $environment)$messagea string that you'd like to log$environment(optional) the type of environment that should log this message (ie test, dev, live). Defaults todev.
- Enable LogJam in
_config.phpby addingLogJam::EnableLog(); - Check your log file location. Set this in
_ss_environment.phpwith the following:
ini_set('log_errors','on');
ini_set('error_log','/home/mywebsite/logs/php.log');
