Download the PHP package x7media/laravel-planetscale without Composer

On this page you can find all versions of the php package x7media/laravel-planetscale. 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 laravel-planetscale

LaravelPlanetScale

Latest Version on Packagist Total Downloads

This package adds a php artisan pscale:migrate command to your Laravel app which can be used instead of the normal php artisan migrate command when using a PlanetScale database.

Installation

Via Composer

Configuration & Usage

  1. Login to your PlanetScale account and get your Service Token and Service Token ID from the organaization settings. Also take a note of your organization name and production branch name as well for the next steps.

  2. Add the following database level permissions to your Service Token for your app's database:

    • create_branch - Create a database branch
    • delete_branch - Delete a database branch
    • connect_branch - Connect to, or create passwords and certificates for a database branch
    • create_deploy_request - Create a database deploy request
    • read_deploy_request - Read database deploy requests
  3. From the database settings screen on PlanetScale, click the checkmark to enable the "Automatically copy migration data" settings. Select "Laravel" from the migration framework dropdown and it should fill it "migrations" for the migration table name. Then save the database settings. This will allow migration status to be synced across PlanetScale database branches.

  4. Setup the following enviroment variables in your app with the appropriate values:

PLANETSCALE_ORGANIZATION=

PLANETSCALE_PRODUCTION_BRANCH=

PLANETSCALE_SERVICE_TOKEN_ID=

PLANETSCALE_SERVICE_TOKEN=

Additonally yuou'll need to make sure your database name is set under:

DB_DATABASE=

OR

Optionally you can publish the config:

Then customize the values in the config. NOTE: If you take this approach we STRONGLY RECOMMEND that you still use enviroment variables or some other secrets storage at least for your service token and service token ID for security.

  1. Replase the php artisan migrate command in your deployment script or process with this:

NOTE: The pscale:migrate command supports the same options are Laravel's built in migration command, and will pass those options along to it when it gets to that step in the process.

FAQ's

Why is this necessary?

PlanetScale has a lot of advantages when using it as your application's production database. When safe migrations are enabled, you cannot run direct schema changes against your production database branch. Instead, you use the branching flow and Vitess's non-blocking schema migration tooling to run your database migrations safely.

This is accomplished by creating a branch of your schema, running your migrations against that branch and then opening a deploy request to have PlanetScale manage the schema migration for you in production.

This package uses PlanetScale's Public API to automate the process of creating a new development branch, connecting your app to the development branch, running your Laravel migrations on the development branch, merging that back into your production branch, and deleting the development branch. You end up with the best of both, the migration flow you are used to while also taking advantage of PlanetScale's schema migration tools.

Are there any notable limitations to PlanetScale's branching?

Yes, there is one BIG caveat. That is branching and merging is for schema only. So you will need to separate your schema migrations from your data migrations. Use this to run your schema migrations and run your data migrations separately against your production branch.

An alternative method is to disable safe migrations on your production branch, then you can mix schema and data migrations. Then when that is finished re-enable safe migrations to return to using the safe schema change tools.

Change log

Please see the changelog for more information on what has changed recently.

Testing

Contributing

Please see the contributing guidelines.

Note: X7 Media is no longer using PlanetScale for any internal or client databases anymore, as such we will not be making any changes to or activly supporting this package. However, since some of you are still relying on this in production, we will occassionaly review PR's to merge as necessary to add support for future versions of Laravel or to add features or bug fixes.

Security

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

Credits

License

MIT. Please see the license file for more information.


All versions of laravel-planetscale with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ~9|~10
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 x7media/laravel-planetscale contains the following files

Loading the files please wait ....