uepg / laravel-sybase
Sybase based Eloquent module extension for Laravel 10.x
Installs: 10 538
Dependents: 0
Suggesters: 0
Security: 0
Stars: 33
Watchers: 5
Forks: 19
Open Issues: 25
Requires
- php: >=8.1
- ext-pdo: *
- doctrine/dbal: ^3.5.1
- illuminate/database: >=8.0
- illuminate/support: >=8.0
Requires (Dev)
- nunomaduro/collision: ^7.4
- orchestra/testbench: ^8.5
- dev-master
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.0
- 3.0.0
- v2.x-dev
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.1
- 2.3.0
- 2.2.6
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0
- v1.x-dev
- 1.3.2
- 1.3.1
- 1.3
- 1.2.1
- 1.2.0.7
- 1.2.0.6
- 1.2.0.5
- 1.2.0.4
- 1.2.0.3
- 1.2.0.2
- 1.2.0.1
- 1.2
- 1.1
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0
- 0.3.0
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2
- 0.1.1
- 0.1.0
- dev-revert-84-revert-83-laravel-sybase
- dev-revert-83-laravel-sybase
- dev-dev
This package is auto-updated.
Last update: 2025-02-20 12:23:00 UTC
README
- Enables use of multiple kinds of fields.
- Use default eloquent: works with odbc and dblib!
- Migrations! (WIP - Work in Progress)
Install
Add the following in the require section of your composer.json:
Laravel >=7.x
"uepg/laravel-sybase": "~4.0"
Update the package dependencies executing:
composer update
Add the following entry to your providers array in config/app.php file, optional in Laravel 5.5 or above:
Uepg\LaravelSybase\SybaseServiceProvider::class,
Add the following entry to your aliases array in config/app.php file, optional in Laravel 5.5 or above:
'UepgBlueprint' => Uepg\LaravelSybase\Database\Schema\Blueprint::class,
Update your config/database.php's default driver with the settings for the sybase or your custom odbc. See the following example:
<?php ... return [ ... 'sybase' => [ 'application_encoding' => false, 'application_charset' => '', 'database_charset' => '' ], 'connections' => [ ... 'sybase' => [ 'driver' => 'sybasease', 'host' => env('DB_HOST', 'sybase.myserver.com'), 'port' => env('DB_PORT', '5000'), 'database' => env('DB_DATABASE', 'mydatabase'), 'username' => env('DB_USERNAME', 'user'), 'password' => env('DB_PASSWORD', 'password'), 'charset' => 'utf8', 'prefix' => '', 'cache_tables' => true, 'cache_time' => 3600 ], ... ], ... ]
Update your .env with the settings for the sybase or your custom odbc. See the following example:
...
DB_CONNECTION=sybase
DB_HOST=sybase.myserver.com
DB_PORT=5000
DB_DATABASE=mydatabase
DB_USERNAME=user
DB_PASSWORD=password
...
Configuration of freetds driver
In Linux systems the driver version must be set in freetds.conf file to the right use of charset pages.
The file is usualy found in /etc/freetds/freetds.conf. Set the configuration at global section as the following example:
[global]
# TDS protocol version
tds version = 5.0
Configuring the charset conversion
This package offers to method to charset conversion, it can be converted in application layer or in database layer, we offered both methods because it can be useful for debugging, to config the application layer conversion you need to set up the following entries on the database.php
file. You can view an example of the application encoding setup below:
'sybase' =>
[
'application_encoding' => true,
'application_charset' => '',
'database_charset' => ''
],
To use the database layer conversion add the property charset to connection configuration on the sybase configuration array
'charset' => 'utf8',
Configuring the cache
As the library consults table information whenever it receives a request, caching can be used to avoid excessive queries
To use the cache, add the property cache_tables
to the database.php connection configuration, you can customize the time of the cache with the property cache_time
in the same configuration
'cache_tables' => true, 'cache_time' => 3600
Setting to use numeric data type
In the migration file you must replace use Illuminate\Database\Schema\Blueprint;
with use Uepg\LaravelSybase\Database\Schema\Blueprint;
. See the following example:
<?php use Illuminate\Support\Facades\Schema; // use Illuminate\Database\Schema\Blueprint; use Uepg\LaravelSybase\Database\Schema\Blueprint; // or "use UepgBlueprint as Blueprint" use Illuminate\Database\Migrations\Migration; class CreateTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('table_name', function (Blueprint $table) { $table->numeric('column_name', length, autoIncrement); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('table_name'); } }