PHPackages                             mobytes/schemas - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. mobytes/schemas

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mobytes/schemas
===============

013PHP

Since Dec 3Pushed 10y ago1 watchersCompare

[ Source](https://github.com/Mobytes/PGSchema)[ Packagist](https://packagist.org/packages/mobytes/schemas)[ RSS](/packages/mobytes-schemas/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel PGSchema
================

[](#laravel-pgschema)

References to

With this package you can create, switch and drop postgresql schemas easily. This is very useful when you are working with multi-tenants applications.

Installation
------------

[](#installation)

1. Use composer to add the package into your project using `composer require pacuna/schemas:dev-master`
2. Add 'Pacuna\\Schemas\\SchemasServiceProvider' to your app.php file in the services providers section.
3. Add 'PGSchema' =&gt; 'Pacuna\\Schemas\\Facades\\PGSchema' into the aliases section

Usage
-----

[](#usage)

Assuming that you have your db configuration ready, meaning that your default connection is 'pgsql' and your pgsql credentials are setted in the usual way, you can use the next functions:

### Create new Schema

[](#create-new-schema)

`PGSchema::create($schemaName)`

### Switch to Schema

[](#switch-to-schema)

`PGSchema::switchTo($schemaName)`

if switchTo is call without arguments, it switches to the public schema (default)

### Drop Schema

[](#drop-schema)

`PGSchema::drop($schemaName)`

### Migrate Schema

[](#migrate-schema)

`PGSchema::migrate($schemaName, args[])`

For example create a migrations in a custom path: `php artisan migrate:make create_dogs_table --create=dogs --path=app/database/migrations/foo`

Then you can migrate some schema using this path `PGSchema::migrate($schemaName, ['--path' => 'app/database/migrations/foo'])`

Multi-tenancy Example (SaaS)
----------------------------

[](#multi-tenancy-example-saas)

Checkout this repo In the handlers folder you can find the code that contains calls to the package.

Laravel version
---------------

[](#laravel-version)

Current package version works for Laravel 4.2

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a026466a8b6acdb3042a279467fddf5e8f4b4585ce8d81da1af8d33d33a068e?d=identicon)[evervasquez](/maintainers/evervasquez)

---

Top Contributors

[![evervasquez](https://avatars.githubusercontent.com/u/2586206?v=4)](https://github.com/evervasquez "evervasquez (9 commits)")

### Embed Badge

![Health badge](/badges/mobytes-schemas/health.svg)

```
[![Health](https://phpackages.com/badges/mobytes-schemas/health.svg)](https://phpackages.com/packages/mobytes-schemas)
```

###  Alternatives

[tatter/alerts

Lightweight user alerts for CodeIgniter 4

3978.7k6](/packages/tatter-alerts)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
