Download the PHP package c975l/services-bundle without Composer
On this page you can find all versions of the php package c975l/services-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download c975l/services-bundle
More information about c975l/services-bundle
Files in c975l/services-bundle
Package services-bundle
Short Description Commons services used by c975L bundles
License MIT
Homepage https://github.com/975L/ServicesBundle
Informations about the package services-bundle
ServicesBundle
ServicesBundle does the following:
- Defines services used by c975L bundles,
- Defines translations used by c975L bundles,
- As a kind of "bonus" also includes
.sh
scripts (see at the bottom),
ServicesBundle dedicated web page.
ServicesBundle API documentation.
Bundle installation
Step 1: Download the Bundle
Use Composer to install the library
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php
file of your project:
How to use
Call the needed service via its interface and use its methods.
Resize image
If you want to resize an image, you can do the following:
Create Flash message
If you want to create a flash message, you can do the following:
.sh
scripts
These scripts are not directly related to Symfony but to its production steps for GitHookPostUpdate.sh
and its backup BackupXXX.sh
. **They are programmed to work on the Synfony 4(flex) structure AND on a GNU/Linux server. You can find more information on them below.
GitHookPostUpdate.sh
This script is to be run after the Git repository has been updated (via git pull
), for this, it's call should be placed in the .git/hooks/post-update
file with the following code:
ImportSqlFile.sh
This script is useful if you store some SQL queries in a file to allow bulk import directly to MySql server. The script will rename the imported file (must be "/var/tmp/sqlFile.sql") before processing, to avoid collisions, and will rename it, after, with date and time. You can then simply add a new cron with the following code:
It will also delete files older than 7 days. It uses the data define in /config/backup_config.cnf
, see below.
BackupXXX.sh
These scripts helps for the backup of a website, they are detailed below. The backup files are stored in /var/backup/{year}/[year-month]/{year-month-day}
. The files are named using the following scheme: "[MYSQL|WEBSITE]_-NAME-YYYY-MM-DD-HH-II-_[WithoutArchives|Archives|Complete|Partial].tar.bz2".
You can include them in a crontab like in the following to execute each hour between 06 and 22 at the 15 minute:
An email wil be sent via cron on each error and only once a day (at the hour specified in config file, see below) to sum up the backup actions.
You have to create a config file /config/backup_config.cnf
with the following data (without space) Keep in mind to add this file to your .gitignore
:
BackupServer.sh
This script groups calls for BackupMysql.sh
and BackupFiles.sh
to allow only one crontab but they can be called individually.
BackupMysql.sh
This script makes a backup of the tables in MySql server. All the tables are mysqldumped (one by one, to allow restore table by table) at each run, except those named with _archives
which occurs once a day at the hour specified in /config/backup_config.cnf
. There is also a mysqldump of the whole database, at the same hour specified as for *_archives
, to allow a restore with only one file. The format used for the naming is "NAME_-_TABLE.sql".
BackupFolders.sh
This script makes a backup of the public
folder. There is a complete backup once a week and a partial backup (only new and newer files) other times.
You can specify a list of patterns to exclude, separated with lines break, in a file named /config/backup_exclude.cnf
i.e */folder_to_exclude
.
Twig Extensions
Using the provided Twig extension RouteExists
you can check via {% if route_exists('YOUR_ROUTE_TO_CHECK') %}
if the Route is available.
Using the provided Twig extension TemplateExists
you can check via {% if template_exists('YOUR_TEMPLATE_TO_CHECK') %}
if the template is available.
Lists
You can use the provided lists:
- extensions
- bots to check against. They can be called by the following code (requires c975L/ConfigBundle):
If this project help you to reduce time to develop, you can sponsor me via the "Sponsor" button at the top :)
All versions of services-bundle with dependencies
c975l/config-bundle Version *
cocur/slugify Version *
doctrine/orm Version *
symfony/routing Version *
symfony/security-bundle Version *
symfony/translation Version *