- Cisco valet linux drivers
- Introduction
- Requirements
- Ubuntu
- Ubuntu 14.04
- Installation
- Extra Features
- Switching PHP version
- Database
- Change password
- List databases
- Creating database
- Dropping database
- Resetting database
- Exporting database
- Importing database
- Subdomains
- MailHog
- SMTP Credentials for MailHog
- Redis
- Serving sites
- For example:
- Domain Alias / Symlinks
- Securing Sites With TLS
- Sharing Sites on LAN
- Log locations
- php.ini location
- Valet drivers
- Custom Valet Drivers
- The serves Method
- The isStaticFile Method
- The frontControllerPath Method
- Local Drivers
- Introduction
- Requirements
- Ubuntu
- Ubuntu 14.04
- Installation
- Extra Features
- Switching PHP version
- Database
- Change password
- List databases
- Creating database
- Dropping database
- Resetting database
- Exporting database
- Importing database
- Subdomains
- MailHog
- SMTP Credentials for MailHog
- Redis
- Serving sites
- For example:
- Domain Alias / Symlinks
- Securing Sites With TLS
- Sharing Sites on LAN
- Log locations
- php.ini location
- Valet drivers
- Custom Valet Drivers
- The serves Method
- The isStaticFile Method
Cisco valet linux drivers
Introduction
Valet Linux+ is a development environment for Linux. No Vagrant, no Docker, no /etc/hosts file.
Since Valet Linux+ is intended to replace Valet, it still uses the same valet command-line name. Any changes in its interface are documented below.
Requirements
Ubuntu
Requirement | Description |
---|---|
Ubuntu version | 14.04+ |
OS packages | sudo apt-get install network-manager libnss3-tools jq xsel |
PHP version | 7.1+ |
PHP extensions | php-cli php-curl php-mbstring php-mcrypt php-xml php-zip |
Replace the star with your php version.*
Ubuntu 14.04
In order to use the valet secure command in Ubuntu 14.04 you need to add the nginx PPA because the version in the Trusty repos does not support http2 .
To add the nginx ppa:
Installation
- Install or update PHP to 7.1+ version.
- Install Composer from official website.
- Install Valet Linux+ with Composer via composer global require genesisweb/valet-linux-plus .
- Add export PATH=»$PATH:$HOME/.composer/vendor/bin» to .bash_profile .
- Run the valet install command. This will configure and install Valet Linux+ and DnsMasq, and register Valet’s daemon to launch when your system starts.
- Once Valet Linux+ is installed, try pinging any *.test domain on your terminal using a command such as ping -c1 foobar.test . If Valet Linux+ is installed correctly you should see this domain responding on 127.0.0.1 . If not you might have to restart your system.
Valet Linux+ will automatically start its daemon each time your machine boots. There is no need to run valet start or valet install ever again once the initial Valet Linux+ installation is complete.
Extra Features
Here are a few key features that we are providing along with Valet:
- PHP switch versions with CLI
- MySQL (with optimized configuration)
- Redis
- Subdomains
- Remote access without valet share
- Many more features outlined below.
Switching PHP version
Switch PHP version using one of five commands:
Use —update-cli flag to update PHP cli version as well.
Database
Valet Linux+ automatically installs MySQL 5.7 with 5.6 compatibility mode included. It includes a tweaked my.cnf which is aimed at improving speed.
Change password
It can be single line of code to change your MySQL password. We don’t have to always login to MySQL and find for the query and execute it. It’s just that simple as below:
List databases
You can get list of all databases with single command
Creating database
Create new database using:
When no name is given it’ll try to find the closest git repository directory name. When it can’t find one it’ll use the current working directory name.
Dropping database
Drop a database using:
When no name is given it’ll try to find the closest git repository directory name. When it can’t find one it’ll use the current working directory name.
Resetting database
Drop and create a database using:
When no name is given it’ll try to find the closest git repository directory name. When it can’t find one it’ll use the current working directory name.
Exporting database
Export a database:
When no database name is given it’ll use the current working directory name.
All database exports are gzipped. You can still export SQL file using —sql flag as shown below
Importing database
Import a database with progress bar
When no name is given it’ll try to find the closest git repository directory name. When it can’t find one it’ll use the current working directory name.
You can import .sql directly as well as gzipped .sql.gz database exports.
Subdomains
You can manage subdomains for the current working directory using:
Will create welcome.yourproject.test .
MailHog
MailHog is widely used to catch emails which is sent from development code, it can be very helpful to test your email templates or email development.
You can access the panel at http://mailhog.test.
SMTP Credentials for MailHog
Redis
Redis is automatically installed and listens on the default port 6379 . The redis socket is located at /tmp/redis.sock
Serving sites
Once Valet Linux+ is installed, you’re ready to start serving sites. Valet Linux+ provides a command to help you serve your sites: valet park . Which will register the current working directory as projects root. Generally this directory is
Create a sites directory and park valet over there, so you can access all of your project from parked directory:
That’s all there is to it. Now, any project you create within your «parked» directory will automatically be served using the http://folder-name.test convention.
For example:
/sites/example
Domain Alias / Symlinks
Display all of the registered symbolic links based on the current folder.:
Will create a symbolic link to the current folder yourproject2.test .
Securing Sites With TLS
By default, Valet serves sites over plain HTTP. However, if you would like to serve a site over encrypted TLS using HTTP/2, use the secure command. For example, if your site is being served by Valet on the example.test domain, you should run the following command to secure it:
To «unsecure» a site and revert back to serving its traffic over plain HTTP, use the unsecure command. Like the secure command, this command accepts the host name you wish to unsecure:
Sharing Sites on LAN
By default, Valet Linux+ sites provide support to access your valet site on LAN access, it can be helpful to access site on different devices with your lan IP address, you don’t have to do any additional changes. just open your LAN IP address instead of localhost and you will be able to see your available site lists. you may can find your LAN IP address via ifconfig command.
As we can see the domain is changed to your remote IP address, so it won’t be possible to run the site on SSL same as we run it with dedicated domain.
Log locations
The nginx-error.log , php.log and mysql.log are located at
php.ini location
The php.ini location is /etc/php/
Valet drivers
Valet uses drivers to handle requests. You can read more about those here.
By default these are included:
- CakePHP 3
- Craft
- Drupal
- Jigsaw
- Laravel
- Lumen
- Magento
- Magento 2
- Neos
- Pimcore 5
- Shopware 5
- Slim
- Statamic
- Static HTML
- Symfony
- Typo3
- WordPress / Bedrock
- Zend Framework
A full list can be found here.
Custom Valet Drivers
You can write your own Valet «driver» to serve PHP applications running on another framework or CMS that is not natively supported by Valet. When you install Valet Linux+, a
/.valet/Drivers directory is created which contains a SampleValetDriver.php file. This file contains a sample driver implementation to demonstrate how to write a custom driver. Writing a driver only requires you to implement three methods: serves , isStaticFile , and frontControllerPath .
All three methods receive the $sitePath , $siteName , and $uri values as their arguments. The $sitePath is the fully qualified path to the site being served on your machine, such as /Users/Lisa/Sites/my-project . The $siteName is the «host» / «site name» portion of the domain ( my-project ). The $uri is the incoming request URI ( /foo/bar ).
Once you have completed your custom Valet Linux+ driver, place it in the
/.valet/Drivers directory using the FrameworkValetDriver.php naming convention. For example, if you are writing a custom valet driver for WordPress, your file name should be WordPressValetDriver.php .
Let’s take a look at a sample implementation of each method your custom Valet Linux+ driver should implement.
The serves Method
The serves method should return true if your driver should handle the incoming request. Otherwise, the method should return false . So, within this method you should attempt to determine if the given $sitePath contains a project of the type you are trying to serve.
For example, let’s pretend we are writing a WordPressValetDriver . Our serve method might look something like this:
The isStaticFile Method
The isStaticFile should determine if the incoming request is for a file that is «static», such as an image or a stylesheet. If the file is static, the method should return the fully qualified path to the static file on disk. If the incoming request is not for a static file, the method should return false :
The isStaticFile method will only be called if the serves method returns true for the incoming request and the request URI is not / .
The frontControllerPath Method
The frontControllerPath method should return the fully qualified path to your application’s «front controller», which is typically your «index.php» file or equivalent:
Local Drivers
If you would like to define a custom Valet driver for a single application, create a LocalValetDriver.php in the application’s root directory. Your custom driver may extend the base ValetDriver class or extend an existing application specific driver such as the LaravelValetDriver :
Introduction
Valet Linux+ is a development environment for Linux. No Vagrant, no Docker, no /etc/hosts file.
Since Valet Linux+ is intended to replace Valet, it still uses the same valet command-line name. Any changes in its interface are documented below.
Requirements
Ubuntu
Requirement | Description |
---|---|
Ubuntu version | 14.04+ |
OS packages | sudo apt-get install network-manager libnss3-tools jq xsel |
PHP version | 7.1+ |
PHP extensions | php-cli php-curl php-mbstring php-mcrypt php-xml php-zip |
Replace the star with your php version.*
Ubuntu 14.04
In order to use the valet secure command in Ubuntu 14.04 you need to add the nginx PPA because the version in the Trusty repos does not support http2 .
To add the nginx ppa:
Installation
- Install or update PHP to 7.1+ version.
- Install Composer from official website.
- Install Valet Linux+ with Composer via composer global require genesisweb/valet-linux-plus .
- Add export PATH=»$PATH:$HOME/.composer/vendor/bin» to .bash_profile .
- Run the valet install command. This will configure and install Valet Linux+ and DnsMasq, and register Valet’s daemon to launch when your system starts.
- Once Valet Linux+ is installed, try pinging any *.test domain on your terminal using a command such as ping -c1 foobar.test . If Valet Linux+ is installed correctly you should see this domain responding on 127.0.0.1 . If not you might have to restart your system.
Valet Linux+ will automatically start its daemon each time your machine boots. There is no need to run valet start or valet install ever again once the initial Valet Linux+ installation is complete.
Extra Features
Here are a few key features that we are providing along with Valet:
- PHP switch versions with CLI
- MySQL (with optimized configuration)
- Redis
- Subdomains
- Remote access without valet share
- Many more features outlined below.
Switching PHP version
Switch PHP version using one of five commands:
Use —update-cli flag to update PHP cli version as well.
Database
Valet Linux+ automatically installs MySQL 5.7 with 5.6 compatibility mode included. It includes a tweaked my.cnf which is aimed at improving speed.
Change password
It can be single line of code to change your MySQL password. We don’t have to always login to MySQL and find for the query and execute it. It’s just that simple as below:
List databases
You can get list of all databases with single command
Creating database
Create new database using:
When no name is given it’ll try to find the closest git repository directory name. When it can’t find one it’ll use the current working directory name.
Dropping database
Drop a database using:
When no name is given it’ll try to find the closest git repository directory name. When it can’t find one it’ll use the current working directory name.
Resetting database
Drop and create a database using:
When no name is given it’ll try to find the closest git repository directory name. When it can’t find one it’ll use the current working directory name.
Exporting database
Export a database:
When no database name is given it’ll use the current working directory name.
All database exports are gzipped. You can still export SQL file using —sql flag as shown below
Importing database
Import a database with progress bar
When no name is given it’ll try to find the closest git repository directory name. When it can’t find one it’ll use the current working directory name.
You can import .sql directly as well as gzipped .sql.gz database exports.
Subdomains
You can manage subdomains for the current working directory using:
Will create welcome.yourproject.test .
MailHog
MailHog is widely used to catch emails which is sent from development code, it can be very helpful to test your email templates or email development.
You can access the panel at http://mailhog.test.
SMTP Credentials for MailHog
Redis
Redis is automatically installed and listens on the default port 6379 . The redis socket is located at /tmp/redis.sock
Serving sites
Once Valet Linux+ is installed, you’re ready to start serving sites. Valet Linux+ provides a command to help you serve your sites: valet park . Which will register the current working directory as projects root. Generally this directory is
Create a sites directory and park valet over there, so you can access all of your project from parked directory:
That’s all there is to it. Now, any project you create within your «parked» directory will automatically be served using the http://folder-name.test convention.
For example:
/sites/example
Domain Alias / Symlinks
Display all of the registered symbolic links based on the current folder.:
Will create a symbolic link to the current folder yourproject2.test .
Securing Sites With TLS
By default, Valet serves sites over plain HTTP. However, if you would like to serve a site over encrypted TLS using HTTP/2, use the secure command. For example, if your site is being served by Valet on the example.test domain, you should run the following command to secure it:
To «unsecure» a site and revert back to serving its traffic over plain HTTP, use the unsecure command. Like the secure command, this command accepts the host name you wish to unsecure:
Sharing Sites on LAN
By default, Valet Linux+ sites provide support to access your valet site on LAN access, it can be helpful to access site on different devices with your lan IP address, you don’t have to do any additional changes. just open your LAN IP address instead of localhost and you will be able to see your available site lists. you may can find your LAN IP address via ifconfig command.
As we can see the domain is changed to your remote IP address, so it won’t be possible to run the site on SSL same as we run it with dedicated domain.
Log locations
The nginx-error.log , php.log and mysql.log are located at
php.ini location
The php.ini location is /etc/php/
Valet drivers
Valet uses drivers to handle requests. You can read more about those here.
By default these are included:
- CakePHP 3
- Craft
- Drupal
- Jigsaw
- Laravel
- Lumen
- Magento
- Magento 2
- Neos
- Pimcore 5
- Shopware 5
- Slim
- Statamic
- Static HTML
- Symfony
- Typo3
- WordPress / Bedrock
- Zend Framework
A full list can be found here.
Custom Valet Drivers
You can write your own Valet «driver» to serve PHP applications running on another framework or CMS that is not natively supported by Valet. When you install Valet Linux+, a
/.valet/Drivers directory is created which contains a SampleValetDriver.php file. This file contains a sample driver implementation to demonstrate how to write a custom driver. Writing a driver only requires you to implement three methods: serves , isStaticFile , and frontControllerPath .
All three methods receive the $sitePath , $siteName , and $uri values as their arguments. The $sitePath is the fully qualified path to the site being served on your machine, such as /Users/Lisa/Sites/my-project . The $siteName is the «host» / «site name» portion of the domain ( my-project ). The $uri is the incoming request URI ( /foo/bar ).
Once you have completed your custom Valet Linux+ driver, place it in the
/.valet/Drivers directory using the FrameworkValetDriver.php naming convention. For example, if you are writing a custom valet driver for WordPress, your file name should be WordPressValetDriver.php .
Let’s take a look at a sample implementation of each method your custom Valet Linux+ driver should implement.
The serves Method
The serves method should return true if your driver should handle the incoming request. Otherwise, the method should return false . So, within this method you should attempt to determine if the given $sitePath contains a project of the type you are trying to serve.
For example, let’s pretend we are writing a WordPressValetDriver . Our serve method might look something like this:
The isStaticFile Method
The isStaticFile should determine if the incoming request is for a file that is «static», such as an image or a stylesheet. If the file is static, the method should return the fully qualified path to the static file on disk. If the incoming request is not for a static file, the method should return false :
The isStaticFile method will only be called if the serves method returns true for the incoming request and the request URI is not / .
Источник