PHPackages                             fos1/sf-s-q-l-tools-plugin - 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. fos1/sf-s-q-l-tools-plugin

ActiveSymfony1-plugin[Database &amp; ORM](/categories/database)

fos1/sf-s-q-l-tools-plugin
==========================

Doctrine SQL Tools Plugin for Symfony1. Task to execute SQL files with triggers, procedures and events in order. Compatible with any kind of database engines.

v1.0.4(10y ago)0375MITPHP

Since Aug 20Pushed 10y ago6 watchersCompare

[ Source](https://github.com/FriendsOfSymfony1/sfSQLToolsPlugin)[ Packagist](https://packagist.org/packages/fos1/sf-s-q-l-tools-plugin)[ RSS](/packages/fos1-sf-s-q-l-tools-plugin/feed)WikiDiscussions 1.x Synced 1mo ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

sfSQLToolsPlugin
================

[](#sfsqltoolsplugin)

The `sfSQLToolsPlugin` is a symfony1 plugin that provides easy way to execute database specific features like stored procedures, triggers, events and any other `SQL` commands.

Contents
--------

[](#contents)

It gives you one task to execute `SQL` files with additional options.

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

[](#installation)

- Download the plugin

Add the plugin your `composer.json` requirements:

```
  "require": {
    ...
    "fos1/sf-s-q-l-tools-plugin": "1.0.*",
    ...

```

- Install the plugin: edit your `ProjectConfiguration.class.php` file

```
  $this->enablePlugins(array('sSQLToolsPlugin');

```

- Clear you cache `symfony cc`

Usage
-----

[](#usage)

```
symfony sql:execute [--application[="..."]] [--env[="..."]] [--dir[="..."]] [--dir-depth[="..."]] [--file[="..."]] [--exclude[="..."]] [--delimiter[="..."]]

```

### Options:

[](#options)

- `--application` The application name (default: 1)
- `--env` The environment (default: dev)
- `--dir` The directory where to look for `*.sql` file (default: `data/sql/tasks`)
- `--dir-depth` Search directory depth (default: 0)
- `--file` One file to be executed
- `--exclude` Exclude file pattern or file list separated by commas
- `--delimiter` Query delimiter (default: ~)

Description:
------------

[](#description)

The `sql:execute` task reads `*.sql` files in search directory and then runs them in order

- Call it with:

    $ ./symfony sql:execute
- To work in certain environment run this command with `--env` option

    $ ./symfony sql:execute --env=prod
- To use certain application`s database settings use `--application` option

    $ ./symfony sql:execute --application=frontend
- If you need to customize the `*.sql` location dirname (default is `"data/sql/tasks"`), you can pass a `--dir` option:

    $ ./symfony sql:execute --dir=data/my/folder
- To exclude one or more files from `--dir` folder use `--exclude` option. In order to exclude `"00-misc.sql"` file from `"data/my/folder"` directory use:

    $ ./symfony sql:execute --dir=data/my/folder --exclude="00-misc.sql"
- In order to exclude many files from `"data/my/folder"` directory, separate is by commas:

    $ ./symfony sql:execute --dir=data/my/folder --exclude="00-misc.sql, 10-triggers.sql, 20-events.sql"
- Or you can use [glob](http://php.net/manual/en/function.glob.php "Function glob") patterns (exclude all filename which contains words: U\_"old"\_ and *"backup"*):

    $ ./symfony sql:execute --dir=data/my/folder --exclude="*old*,*backup*"
- To run only one specific `SQL` file use `--file`:

    $ ./symfony sql:execute --file=data/sql/tasks\_1/alter-tables.sql
- or to run one specific file in directory `"data/sql/tasks_1"`

    $ ./symfony sql:execute --dir=data/sql/tasks\_1 --file=alter-tables.sql
- To search for \*.sql file until sub folder certain level use `--dir-depth` option:

    $ ./symfony sql:execute --dir-depth=5
- To search for \*.sql file recursively pass "\*" to `--dir-depth` option:

    $ ./symfony sql:execute --dir-depth=\*

Example
-------

[](#example)

### This is your file "00-procedures.sql" content (MySQL)

[](#this-is-your-file-00-proceduressql-content-mysql)

```
        CREATE PROCEDURE `simpleproc`(OUT param1 INT)
        BEGIN
            SELECT COUNT(*) INTO param1 FROM t;
        END
        ~
        CREATE FUNCTION `hello`(s CHAR(20)) RETURNS CHAR(50)  RETURN CONCAT('Hello, ',s,'!');
        ~
        CREATE PROCEDURE molo() SELECT 'Molo';
```

- Now, setup your DBMS conntecion in config/databases.yml (if you haven't done this yet)
- And execute this procedures in development environment: `symfony sql:execute --env=dev --file=data/sql/00-procedures.sql`
- After you run this task, you should get the following output:

```
>> sql:execute start
>> sql:execute [00-procedures.sql] CREATE PROC...OUNT(*) INTO param1 FROM t; END
>> sql:execute [00-procedures.sql] CREATE FUNC...RETURN CONCAT('Hello, ',s,'!');
>> sql:execute [00-procedures.sql] CREATE PROCEDURE molo() SELECT 'Molo';
>> sql:execute end

```

Unit test
---------

[](#unit-test)

- Unit tests (14 of 14) successfully completed.
- Tested with:
    - `MySQL 5.0.84`
    - `MySQL 5.1.40`
    - `PostgreSQL 8.3.8`

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 85.7% 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.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

3918d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4a788c96bbcf89371ff0c614ad9f1655363369cb8e17ffd7afbebf046da6dad8?d=identicon)[thepanz](/maintainers/thepanz)

---

Top Contributors

[![fruit](https://avatars.githubusercontent.com/u/62828?v=4)](https://github.com/fruit "fruit (18 commits)")[![thePanz](https://avatars.githubusercontent.com/u/226021?v=4)](https://github.com/thePanz "thePanz (3 commits)")

### Embed Badge

![Health badge](/badges/fos1-sf-s-q-l-tools-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/fos1-sf-s-q-l-tools-plugin/health.svg)](https://phpackages.com/packages/fos1-sf-s-q-l-tools-plugin)
```

###  Alternatives

[aaemnnosttv/wp-sqlite-db

SQLite drop-in database driver for WordPress

58563.4k5](/packages/aaemnnosttv-wp-sqlite-db)

PHPackages © 2026

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