Skip to content
This repository has been archived by the owner on Apr 17, 2024. It is now read-only.

Commit

Permalink
add: phplint
Browse files Browse the repository at this point in the history
update: use unmodified i18n.sh
update: README
  • Loading branch information
darkalchemy committed Jul 6, 2020
1 parent 5983186 commit 5550f3b
Show file tree
Hide file tree
Showing 9 changed files with 455 additions and 380 deletions.
56 changes: 31 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,56 +37,62 @@ npm is required
[Vlucas/Valitron](https://github.com/vlucas/valitron) for validation
[uma/redis-session-handler](https://github.com/1ma/RedisSessionHandler) for session handler if using redis for session handling

To install using composer:
```
To install using composer
```text
composer create-project darkalchemy/slim-auth
```

cd into project, edit config/settings.php as needed and create the database.
```
```text
cd slim-auth
nano config/settings.php
```

For Development:
```
npm install # install dependencies
npm run build-dev # create initial js/css resources
composer compile # compile twig templates
After install
```text
composer migrate # import database
```

For Production:
To update for development
```text
composer install # install non-dev dependencies
npm install # install dependencies
npm run build # create initial js/css resources
composer compile # compile twig templates
composer migrate # import database
```

To update for production
```text
composer install --no-dev # install non-dev dependencies
npm install # install dependencies
npm run build # create initial js/css resources
composer compile # compile twig templates
composer migrate # import database
```

Set up cron job, this is necessary to be able to run scripts as www-data when needed:
```
Set up cron job, this is necessary to be able to run scripts as www-data when needed
```text
sudo crontab -e
## add this to root crontab
* * * * * cd /path/to/bootstrap/ && /usr/bin/php jobby.php 1>> /dev/null 2>&1
* * * * * cd /path/to/bootstrap folder/ && /usr/bin/php jobby.php 1>> /dev/null 2>&1
```

Emails do not get sent directly, they are inserted into the database and jobby will take care of sending them.

Compile twig templates for translating:
```
Compile twig templates for translating
```text
composer compile
```

Translate all php files to locale - en_US:
```
Translate all php files to locale - en_US
```text
composer translate en_US
```

Add additional locales:
```
Add additional locales
```text
## check if locale is installed
locale -a
Expand All @@ -108,21 +114,21 @@ sudo service nginx restart
nano bootstrap/container.php
```

Translate all php files to locale - fr_FR:
```
Translate all php files to locale - fr_FR
```text
composer translate fr_FR
```
Then open locale/[en_US|fr_FR]/LC_MESSAGES/messages.po in poedit and edit translation.

Then to create the binary forms of the translations, you need to run again for each locale:
```
Then to create the binary forms of the translations, you need to run again for each locale
```text
composer translate en_EN
composer translate fr_FR
```

### Notes
If you want to use redis as your session handler, you should add this to php.ini and uncomment as needed, TCP or Socket:
```
If you want to use redis as your session handler, you should add this to php.ini and uncomment as needed, TCP or Socket
```text
; TCP
; session.save_handler = redis
; session.save_path = "tcp://127.0.0.1:6379?database=1"
Expand All @@ -133,7 +139,7 @@ If you want to use redis as your session handler, you should add this to php.ini
```

### Available command line commands
```
```text
composer cleanup # runs php_cs_fixer
composer clear_cache # clears all file based caches
composer compile # compile all twig templates
Expand Down
69 changes: 0 additions & 69 deletions bin/i18n.sh

This file was deleted.

2 changes: 1 addition & 1 deletion bin/utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

function translate(string $lang, string $path)
{
copy($path . '/bin/i18n.sh', $path . '/i18n.sh');
copy($path . '/vendor/delight-im/i18n/i18n.sh', $path . '/i18n.sh');
chmod($path . '/i18n.sh', 0775);
passthru(sprintf('./i18n.sh %s', $lang));
unlink($path . '/i18n.sh');
Expand Down
9 changes: 8 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.14",
"overtrue/phplint": "^2.0",
"symfony/var-dumper": "^5.0"
},
"autoload": {
Expand All @@ -68,14 +69,20 @@
"cleanup": "vendor/friendsofphp/php-cs-fixer/php-cs-fixer fix --show-progress=dots -vvv",
"dump": "composer dump-autoload -a",
"post-update-cmd": "composer dump-autoload -o",
"post-create-project-cmd": "php -r \"copy('config/settings.example.php', 'config/settings.php');\"",
"create-migration": "vendor/bin/phinx create -c config/phinx.php --ansi -- ",
"migrate": "vendor/bin/phinx migrate -c config/phinx.php -e default --ansi",
"rollback": "vendor/bin/phinx rollback -c config/phinx.php -e default --ansi -t 0",
"translate": "php bin/utilities.php translate",
"translate-all": "php bin/utilities.php translate-all",
"clear_cache": "php bin/utilities.php clear_cache",
"set-perms": "Umpirsky\\PermissionsHandler\\ScriptHandler::setPermissions",
"phplint": "phplint ./ --exclude=vendor --no-cache",
"post-create-project-cmd": [
"php -r \"copy('config/settings.example.php', 'config/settings.php');\"",
"npm install",
"npm run build-dev",
"composer compile"
],
"post-install-cmd": [
"composer dump-autoload -o",
"Umpirsky\\PermissionsHandler\\ScriptHandler::setPermissions"
Expand Down
Loading

0 comments on commit 5550f3b

Please sign in to comment.