承接 levacic/laravel-whoops-editor-link 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

levacic/laravel-whoops-editor-link

Composer 安装命令:

composer require levacic/laravel-whoops-editor-link

包简介

Fixed the Sublime editor link path when running a project from a VM

README 文档

README

This tiny package rewrites the file link in Whoops's Pretty Page handler, when used within a Laravel project.

When running your project within a virtual machine, the links generated by Whoops will point to the file path within the virtual machine, which are inaccessible from your host environment. In order for these links to work, they must be rewritten so they would point to the correct file on the host machine. Using this package, it's easy to fix these links.

Installation

In your project root, do this:

composer require levacic/laravel-whoops-editor-link:~1

Alternatively, you may specify whichever package version is currently available when you install the package, e.g. ~1.0.3.

After that, publish the configuration file:

php artisan config:publish levacic/laravel-whoops-editor-link

This will copy the configuration file into app/config/packages/levacic/laravel-whoops-editor-link/path.php, and you should configure the appropriate paths for your environment.

For example, if your application on your host machine is located in /home/username/www/application, and within your virtual machine, the application root is in /var/www/sites/application, your configuration should look something like this:

<?php

return [

	/**
	 * The path to the application root on the host machine.
	 *
	 * Don't use a trailing slash!
	 */
	'host' => '/home/username/www/application',

	/**
	 * The path to the application root on the guest machine.
	 *
	 * Don't use a trailing slash!
	 */
	'guest' => '/var/www/sites/application',

];

However, if you do this, you'll have hardcoded application paths within your application repo, which is considered bad practice. The recommended way to configure this package is to configure the paths using Laravel's environment variables, naming the variables, for example, APP_ROOT_HOST and APP_ROOT_GUEST, and setting your configuration to use these:

<?php

return [

	/**
	 * The path to the application root on the host machine.
	 *
	 * Don't use a trailing slash!
	 */
	'host' => getenv('APP_ROOT_HOST'),

	/**
	 * The path to the application root on the guest machine.
	 *
	 * Don't use a trailing slash!
	 */
	'guest' => getenv('APP_ROOT_GUEST'),

];

Finally, you need to add the package's service provider to your app.providers array:

	'providers' => array(

		/** Various Illuminate service providers **/

		'Levacic\LaravelWhoopsEditorLink\LaravelWhoopsEditorLinkServiceProvider',

	),

Of course, for this to work, you need to also have the appropriate protocol handler configured on your system for subl:// links.

Compatibility

This package is written for Laravel 4.2, and at the time of this writing, Laravel 5.0 is not stable yet. When it's released, the package will also be updated (if needed) to work with it. Feel free to contact me if you need it, and I forgot about it!

Contributing

There's not really much to contribute here, due to the very specific scope of what this package does, but I guess we could add the same functionality for other editors - if anyone needs this, or wants to add the functionality, just open an issue or a pull request, and we'll fix it.

License

The package is licensed as open-source software under the MIT license.

统计信息

  • 总下载量: 385
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-09-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固