PHPackages                             pacuna/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. [Database &amp; ORM](/categories/database)
4. /
5. pacuna/schemas

ActiveLibrary[Database &amp; ORM](/categories/database)

pacuna/schemas
==============

Laravel package for managing postgresql schemas

4265.9k21[4 issues](https://github.com/pacuna/Laravel-PGSchema/issues)1PHP

Since Jun 20Pushed 7y ago6 watchersCompare

[ Source](https://github.com/pacuna/Laravel-PGSchema)[ Packagist](https://packagist.org/packages/pacuna/schemas)[ RSS](/packages/pacuna-schemas/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (1)

\[LOOKING FOR MAINTAINER\]

Please contact me if you are interested in maintaining this library. I no longer work with Laravel so I'm not able to keep up with the updates.

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

[](#laravel-pgschema)

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 5. If you need Laravel 4 support checkout for the laravel4 branch.

###  Health Score

32

—

LowBetter than 69% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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/1cf0ef5eb7e54a694781f6e44e1cf07c94779e39203208feb46c49bf0f51a640?d=identicon)[pacuna](/maintainers/pacuna)

---

Top Contributors

[![nthndnn](https://avatars.githubusercontent.com/u/1976300?v=4)](https://github.com/nthndnn "nthndnn (4 commits)")[![otepas](https://avatars.githubusercontent.com/u/10854206?v=4)](https://github.com/otepas "otepas (2 commits)")[![bthecohen](https://avatars.githubusercontent.com/u/1597539?v=4)](https://github.com/bthecohen "bthecohen (1 commits)")[![EspadaV8](https://avatars.githubusercontent.com/u/115825?v=4)](https://github.com/EspadaV8 "EspadaV8 (1 commits)")

### Embed Badge

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

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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