Download the PHP package nedwors/hopper without Composer

On this page you can find all versions of the php package nedwors/hopper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package hopper

Hopper

Tests

Hop between databases with ease whilst developing locally on Laravel.

Imagine: A colleague asks you to check their PR out. But you're working on a new feature yourself and your local database is *just* right. You've got it tuned with the right models, the right data - losing it would just be an inconvenience too far...

So now imagine: A colleague asks you to check their PR out. You jump onto their branch, set up your database - migrate it, seed it, wipe it, whatever - and review their work. Then, you return to your feature and pick up where you left off - with your database still intact.

Enter Hopper. It's as simple as:

Now, you're on a database called awesome_new_feature.

With Git, it's even simpler:

Now, you're on a database for the current branch!

And you can always hop back to your default database with:

Now, you're on the default database as configured by your Laravel settings.

Installation

You can install the package via composer:

Setup

Hopper comes with a config file for you to publish to config/hopper.php:

You don't need to publish the config file to use Hopper, but it is recommended. But no pressure. Honest... See configuration to see whether you want to for your project.

Usage

Commands:

Configuration:

Commands

hop

This is the core command when using Hopper. There are 3 ways it can be used:

Using a database for the current Git branch

This option is where Hopper really shines. Simply checkout a branch, hop, and you're on a new database. Checkout your previous branch, hop, and you're back to where you started.

To use Hopper this way, simply hop without arguments:

Now, when using your app, it will be connected to the updates database.

Your default Git branch aliases to your default database. So, imagine main is your default branch. When you run this:

You won't move to the a database called main. Instead, you'll be moved to your default database - simple!

But don't worry, you're not forced to use the current Git branch. You can also specify a name at any point, or manually use the default branch.

Using a specific database

To use a specific database, simply pass the name of the database to use:

Now, when using your app, it will be connected to the foobar database.

Using the default database

To use the default database, pass the --d option to the command:

Now, your app simply uses the default database as is set up in Laravel.

Hopper steps aside when the default database is used; it doesn't touch your database connection. This is useful for team members who might not want to use Hopper themselves. They can rest assured that Hopper isn't interfering with their setup.

Post Creation

When it is the first time using a database, Hopper will create it ready to use. Likely, you'll want to migrate and setup up this database. Hopper provides a clean way to run Post Creation Steps - see how you can set these up.

hop:current

See the database that you are currently using:

hop:delete

Delete the given database:

When a database is deleted, you will be moved back to your default database.

Configuration

As stated in setup, you don't need to publish the hopper config file to use Hopper. The config file is as so:

We'd encourage to checkout all the options described below to see if you want to publish it or not.

Default Git Branch

You should define here the name of the default git branch in your project:

Now, every time you hop on this branch without arguments, your default database will be used automatically - rather than a database called main.

You'll see that there is a HOPPER_DEFAULT_BRANCH .env variable available too - this means you can alter this value without publishing the config file.

Connections

Currently, Hopper has built in support for sqlite and mysql database connections. Hopper will automatically use whichever connection you are using.

These and future drivers are exposed and configured in the config file - which means you can add your own even if Hopper doesn't yet support it natively! See the supported connections in hopper.php:

Sqlite

Hopper stores all Sqlite databases within a relative directory in the database directory of your application. You can configure the name of the directory in the config file:

So, as you might expect, all temporary databases created by Hopper will be stored in database/hopper/. So for example, running this command...

...will create a sqlite database at database/hopper/test.sqlite.

The hopper directory will be created by Hopper if it doesn't already exist

All database names passed to hopper when using Sqlite will be sanitized. Slashes will be automatically converted to dashes for the Sqlite connection. So for instance, hop this/database will create a database called this-database.sqlite

It's probably worth adding your chosen directory to your .gitignore when using the sqlite connection!

MySql

Hopper creates all MySql databases on your configured MySql connection. All databases created will have a prefix applied to their name so you can easily identify them as needed. You can configure the prefix in the config file:

So for example, running this command...

...will create a MySql database called hopper_test.

All database names passed to hopper when using MySql will be sanitized. Dashes will be automatically converted to underscores for the MySql connection. So for instance, hop this-database will create a database called hopper_this_database

Adding your own

Hopper makes it nice and easy to add your own connection for a database type this is supported by Laravel but not by Hopper.

To add your own connection, create a class that implements the Connection interface. You can refer to the existing connections to see how to build your new implementation. When you are ready to implement it, add it to the connections array:

Boot Checks

Hopper exposes the checks it runs prior to wiring up your database connection. This way, you can alter the existing checks and/or add your own if needed. They are found in the hopper.php config file:

The included Environment check ensures the app environment is local. To add your own, ensure your class either implements the BootCheck interface or exposes a check() method which returns a boolean. Then, pop the class name in this array and you're all set.

Post Creation Steps

It is super simple to configure the steps you want to run after creating a new database.

The steps can be found in the hopper.php config file:

All strings included in this array must refer to an Artisan command in your app.

Closures can also be defined:

All steps are run in order of declaration, so ensure you migrate your database before any seeders!

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

Laravel Package Boilerplate

This package was generated using the Laravel Package Boilerplate.


All versions of hopper with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0
illuminate/support Version ^7.2|^8.0
spatie/laravel-package-tools Version ^1.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package nedwors/hopper contains the following files

Loading the files please wait ....