survos / maker-bundle
Tools to generate controllers and templates for the admin interface
Fund package maintenance!
kbond
Installs: 1 879
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.3
- nette/php-generator: ^3.5||^4.1
- roave/better-reflection: ^6.0
- sebastian/diff: ^4.0||^5.0||^6.0.1
- symfony/config: ^6.4 || ^7.1
- symfony/console: ^6.4 || ^7.1
- symfony/options-resolver: ^6.4 || ^7.1
- symfony/security-http: ^6.4 || ^7.1
- symfony/string: ^6.4 || ^7.1
- twig/twig: ^3.4
- zenstruck/console-extra: ^1.4
Requires (Dev)
- doctrine/doctrine-bundle: ^2.7
- doctrine/orm: ^2.12 || ^3.3
- haydenpierce/class-finder: ^0.4.3
- phpstan/phpstan: ^2.0
- squizlabs/php_codesniffer: ^3.7
- symfony/form: ^6.4 || ^7.1
- symfony/http-client: ^6.4 || ^7.1
- symfony/maker-bundle: ^1.5
- symfony/phpunit-bridge: ^6.4 || ^7.1
- symfony/polyfill-php80: ^1.16.0
- symfony/process: ^6.4 || ^7.1
- symfony/security-core: ^6.4 || ^7.1
- symfony/security-csrf: ^6.4 || ^7.1
- symfony/twig-bundle: ^6.4 || ^7.1
- symfony/validator: ^6.4 || ^7.1
- symfony/yaml: ^6.4 || ^7.1
Suggests
- symfony/workflow: To generate a workflow from PHP constants
- symplify/easy-coding-standard: cleanup generated files
Conflicts
- survos/api-grid-bundle: <1.2.57
- survos/auth-bundle: <1.2.57
- survos/barcode-bundle: <1.2.57
- survos/bootstrap-bundle: <1.2.57
- survos/command-bundle: <1.2.57
- survos/core-bundle: <1.2.57
- survos/crawler-bundle: <1.2.57
- survos/doc-bundle: <1.2.57
- survos/faker-bundle: <1.2.57
- survos/grid-bundle: <1.2.57
- survos/grid-group-bundle: <1.2.57
- survos/html-prettify-bundle: <1.2.57
- survos/import-bridge: <1.2.57
- survos/inspection-bundle: <1.2.57
- survos/location-bundle: <1.2.57
- survos/providence-bundle: <1.2.57
- survos/ruler-bundle: <1.2.57
- survos/stripe-product: <1.2.57
- survos/tree-bundle: <1.2.57
- survos/wiki-bundle: <1.2.57
- survos/workflow-helper-bundle: <1.2.57
- dev-main / 1.6.x-dev
- 1.5.442
- 1.5.441
- 1.5.440
- 1.5.439
- 1.5.438
- 1.5.437
- 1.5.436
- 1.5.435
- 1.5.434
- 1.5.433
- 1.5.432
- 1.5.431
- 1.5.430
- 1.5.429
- 1.5.428
- 1.5.427
- 1.5.426
- 1.5.425
- 1.5.424
- 1.5.423
- 1.5.422
- 1.5.421
- 1.5.420
- 1.5.419
- 1.5.418
- 1.5.417
- 1.5.416
- 1.5.415
- 1.5.414
- 1.5.413
- 1.5.412
- 1.5.411
- 1.5.410
- 1.5.409
- 1.5.408
- 1.5.407
- 1.5.406
- 1.5.405
- 1.5.404
- 1.5.403
- 1.5.402
- 1.5.401
- 1.5.400
- 1.5.399
- 1.5.398
- 1.5.397
- 1.5.396
- 1.5.395
- 1.5.394
- 1.5.393
- 1.5.392
- 1.5.391
- 1.5.390
- 1.5.389
- 1.5.388
- 1.5.387
- 1.5.386
- 1.5.385
- 1.5.384
- 1.5.383
- 1.5.382
- 1.5.381
- 1.5.380
- 1.5.379
- 1.5.378
- 1.5.377
- 1.5.376
- 1.5.375
- 1.5.374
- 1.5.373
- 1.5.372
- 1.5.371
- 1.5.370
- 1.5.369
- 1.5.368
- 1.5.367
- 1.5.366
- 1.5.365
- 1.5.364
- 1.5.363
- 1.5.362
- 1.5.361
- 1.5.360
- 1.5.359
- 1.5.358
- 1.5.357
- 1.5.356
- 1.5.355
- 1.5.354
- 1.5.353
- 1.5.352
- 1.5.351
- 1.5.350
- 1.5.349
- 1.5.345
- 1.5.344
- 1.5.343
- 1.5.342
- 1.5.341
- 1.5.340
- 1.5.339
- 1.5.338
- 1.5.337
- 1.5.336
- 1.5.335
- 1.5.334
- 1.5.333
- 1.5.332
- 1.5.331
- 1.5.330
- 1.5.329
- 1.5.328
- 1.5.327
- 1.5.326
- 1.5.325
- 1.5.324
- 1.5.323
- 1.5.322
- 1.5.321
- 1.5.320
- 1.5.319
- 1.5.318
- 1.5.317
- 1.5.316
- 1.5.315
- 1.5.314
- 1.5.313
- 1.5.312
- 1.5.311
- 1.5.310
- 1.5.309
- 1.5.308
- 1.5.307
- 1.5.306
- 1.5.305
- 1.5.304
- 1.5.303
- 1.5.302
- 1.5.301
- 1.5.300
- 1.5.299
- 1.5.298
- 1.5.297
- 1.5.296
- 1.5.295
- 1.5.294
- 1.5.293
- 1.5.292
- 1.5.291
- 1.5.290
- 1.5.289
- 1.5.288
- 1.5.287
- 1.5.286
- 1.5.285
- 1.5.284
- 1.5.283
- 1.5.282
- 1.5.281
- 1.5.280
- 1.5.279
- 1.5.278
- 1.5.277
- 1.5.276
- 1.5.275
- 1.5.274
- 1.5.273
- 1.5.272
- 1.5.271
- 1.5.270
- 1.5.269
- 1.5.268
- 1.5.267
- 1.5.266
- 1.5.265
- 1.5.264
- 1.5.263
- 1.5.262
- 1.5.261
- 1.5.260
- 1.5.259
- 1.5.258
- 1.5.257
- 1.5.256
- 1.5.255
- 1.5.254
- 1.5.253
- 1.5.252
- 1.5.251
- 1.5.250
- 1.5.249
- 1.5.248
- 1.5.247
- 1.5.246
- 1.5.245
- 1.5.244
- 1.5.243
- 1.5.242
- 1.5.241
- 1.5.240
- 1.5.239
- 1.5.238
- 1.5.237
- 1.5.236
- 1.5.235
- 1.5.234
- 1.5.233
- 1.5.232
- 1.5.231
- 1.5.230
- 1.5.229
- 1.5.228
- 1.5.227
- 1.5.226
- 1.5.225
- 1.5.224
- 1.5.223
- 1.5.222
- 1.5.221
- 1.5.220
- 1.5.219
- 1.5.218
- 1.5.217
- 1.5.216
- 1.5.215
- 1.5.214
- 1.5.213
- 1.5.212
- 1.5.211
- 1.5.210
- 1.5.209
- 1.5.208
- 1.5.207
- 1.5.206
- 1.5.205
- 1.5.204
- 1.5.203
- 1.5.202
- 1.5.201
- 1.5.200
- 1.5.199
- 1.5.198
- 1.5.197
- 1.5.196
- 1.5.195
- 1.5.194
- 1.5.193
- 1.5.192
- 1.5.191
- 1.5.190
- 1.5.189
- 1.5.188
- 1.5.187
- 1.5.186
- 1.5.185
- 1.5.184
- 1.5.183
- 1.5.182
- 1.5.181
- 1.5.180
- 1.5.179
- 1.5.178
- 1.5.177
- 1.5.176
- 1.5.175
- 1.5.174
- 1.5.173
- 1.5.172
- 1.5.171
- 1.5.170
- 1.5.169
- 1.5.168
- 1.5.167
- 1.5.166
- 1.5.165
- 1.5.164
- 1.5.163
- 1.5.162
- 1.5.161
- 1.5.160
- 1.5.159
- 1.5.158
- 1.5.157
- 1.5.156
- 1.5.155
- 1.5.154
- 1.5.153
- 1.5.152
- 1.5.151
- 1.5.150
- 1.5.149
- 1.5.148
- 1.5.147
- 1.5.146
- 1.5.145
- 1.5.144
- 1.5.143
- 1.5.142
- 1.5.141
- 1.5.140
- 1.5.139
- 1.5.138
- 1.5.137
- 1.5.136
- 1.5.135
- 1.5.134
- 1.5.133
- 1.5.132
- 1.5.131
- 1.5.130
- 1.5.129
- 1.5.128
- 1.5.127
- 1.5.126
- 1.5.125
- 1.5.124
- 1.5.123
- 1.5.122
- 1.5.121
- 1.5.120
- 1.5.119
- 1.5.118
- 1.5.117
- 1.5.116
- 1.5.115
- 1.5.114
- 1.5.113
- 1.5.112
- 1.5.111
- 1.5.110
- 1.5.109
- 1.5.108
- 1.5.107
- 1.5.106
- 1.5.105
- 1.5.104
- 1.5.103
- 1.5.102
- 1.5.101
- 1.5.100
- 1.5.99
- 1.5.98
- 1.5.97
- 1.5.96
- 1.5.95
- 1.5.94
- 1.5.93
- 1.5.92
- 1.5.91
- 1.5.90
- 1.5.89
- 1.5.88
- 1.5.87
- 1.5.86
- 1.5.85
- 1.5.84
- 1.5.83
- 1.5.82
- 1.5.81
- 1.5.80
- 1.5.79
- 1.5.78
- 1.5.77
- 1.5.76
- 1.5.75
- 1.5.74
- 1.5.73
- 1.5.72
- 1.5.71
- 1.5.70
- 1.5.69
- 1.5.68
- 1.5.67
- 1.5.66
- 1.5.65
- 1.5.64
- 1.5.63
- 1.5.62
- 1.5.61
- 1.5.60
- 1.5.59
- 1.5.58
- 1.5.57
- 1.5.56
- 1.5.55
- 1.5.54
- 1.5.53
- 1.5.52
- 1.5.51
- 1.5.50
- 1.5.49
- 1.5.48
- 1.5.47
- 1.5.46
- 1.5.45
- 1.5.44
- 1.5.43
- 1.5.42
- 1.5.41
- 1.5.40
- 1.5.39
- 1.5.38
- 1.5.37
- 1.5.36
- 1.5.35
- 1.5.34
- 1.5.33
- 1.5.32
- 1.5.31
- 1.5.30
- 1.5.29
- 1.5.28
- 1.5.27
- 1.5.26
- 1.5.25
- 1.5.24
- 1.5.23
- 1.5.22
- 1.5.21
- 1.5.20
- 1.5.19
- 1.5.18
- 1.5.17
- 1.5.16
- 1.5.15
- 1.5.14
- 1.5.13
- 1.5.12
- 1.5.11
- 1.5.10
- 1.5.9
- 1.5.8
- 1.5.7
- 1.5.6
- 1.5.5
- 1.5.4
- 1.5.3
- 1.5.2
- 1.5.1
- 1.5.0
- 1.4.103
- 1.4.102
- 1.4.101
- 1.4.100
- 1.4.99
- 1.4.98
- 1.4.97
- 1.4.96
- 1.4.95
- 1.4.94
- 1.4.93
- 1.4.92
- 1.4.91
- 1.4.90
- 1.4.89
- 1.4.88
- 1.4.87
- 1.4.86
- 1.4.85
- 1.4.84
- 1.4.83
- 1.4.82
- 1.4.81
- 1.4.80
- 1.4.79
- 1.4.78
- 1.4.77
- 1.4.76
- 1.4.75
- 1.4.74
- 1.4.73
- 1.4.72
- 1.4.71
- 1.4.70
- 1.4.69
- 1.4.68
- 1.4.67
- 1.4.66
- 1.4.65
- 1.4.64
- 1.4.63
- 1.4.62
- 1.4.61
- 1.4.60
- 1.4.59
- 1.4.58
- 1.4.57
- 1.4.56
- 1.4.55
- 1.4.54
- 1.4.53
- 1.4.52
- 1.4.51
- 1.4.50
- 1.4.49
- 1.4.48
- 1.4.44
- 1.4.43
- 1.4.42
- 1.4.41
- 1.4.40
- 1.4.39
- 1.4.38
- 1.4.37
- 1.4.36
- 1.4.35
- 1.4.34
- 1.4.33
- 1.4.32
- 1.4.31
- 1.4.30
- 1.4.29
- 1.4.28
- 1.4.27
- 1.4.26
- 1.4.25
- 1.4.24
- 1.4.23
- 1.4.22
- 1.4.21
- 1.4.20
- 1.4.19
- 1.4.18
- 1.4.17
- 1.4.16
- 1.4.15
- 1.4.14
- 1.4.13
- 1.4.12
- 1.4.11
- 1.4.10
- 1.4.9
- 1.4.8
- 1.4.7
- 1.4.6
- 1.4.5
- 1.4.4
- 1.4.3
- 1.4.2
- 1.4.1
- 1.4.0
- 1.3.14
- 1.3.13
- 1.3.12
- 1.3.11
- 1.3.10
- 1.3.9
- 1.3.8
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.2.56
- 1.2.55
- 1.2.54
- 1.2.53
- 1.2.52
- 1.2.51
- 1.2.50
- 1.2.49
- 1.2.48
- 1.2.47
- 1.2.46
- 1.2.45
- 1.2.44
- 1.2.43
- 1.2.42
- 1.2.41
- 1.2.40
- 1.2.39
- 1.2.38
- 1.2.37
- 1.2.36
- 1.2.34
- 1.2.33
- 1.2.32
- 1.2.31
- 1.2.30
- 1.2.29
- 1.2.28
- 1.2.27
- 1.2.26
- 1.2.25
- 1.2.24
- 1.2.23
- 1.2.22
- 1.2.21
- 1.2.17
- 1.2.16
- 1.2.15
- 1.2.14
- 1.2.13
- 1.2.12
- 1.2.11
- 1.2.10
- 1.2.9
- 1.2.8
- 1.2.7
- 1.2.6
- v1.2.5
- v1.2.4
- 1.0.2
- 1.0.1
- 1.0
This package is auto-updated.
Last update: 2024-12-15 17:32:27 UTC
README
Some alternatives to the Symfony maker commands.
survos:make:controller
The Symfony make:controller command is very limited. It creates a file and template, but doesn't give the option to set the route or method name, just app_app and index.html.twig.
The survos:make:controller command allows creating a Controller class and individual controller methods.
bin/console survos:make:controller-class Admin \ --inject "App\\Repository\\UserRepository" --route="admin_list_users" --method="listUsers" --security="IsGranted('ROLE_ADMIN')"
Sigh. Most of this is outdated and needs to be cleaned up. Sorry.
Special note about survos:make:bundle
Creating a bundle only works within survos. In fact, it probably shouldn't even be in the maker-bundle because of this restriction, although in theory it should work anyway.
from the survos/survos repository, run
bin/console survos:make:bundle foo-bundle
nette generator bug
symfony new bug --webapp && cd bug composer require nette/php-generator cat > src/Controller/AppController.php << 'END' <?php namespace App\Controller; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Attribute\Route; use Nette\PhpGenerator\ClassType; class AppController extends AbstractController { #[Route('/', name: 'app_generate_class')] public function generateClass(): Response { $class = new ClassType('DemoController'); $class ->setFinal() ->setExtends(AbstractController::class) // ->addImplement(Countable::class) ->addComment("Class description.\nSecond line\n") ->addComment('@property-read Nette\Forms\Form $form'); // generate code simply by typecasting to string or using echo: return new Response($class, 200, ['Content-Type' => 'text/plain']); } } END symfony server:start -d symfony open:local
symfony new --webapp maker-demo && cd maker-demo composer require survos/maker-bundle --dev composer require survos/core-bundle # make an entity, using the symfony command # Create a command line program to load the data. bin/console survos:make:command app:load-congress -barg purge cat < EOL | bin/console survos:class:update -m __invoke \n --use Doctrine\ORM\EntityManagerInterface \n --inject EntityManagerInterface$em dd('test') EOL bin/console survos:make:command app:show-congress --oarg pattern "Show a list of representatives" --oint-arg limit
This bundle has a dependency of Symfony's Maker Bundle, so install that first.
composer req symfony/maker-bundle --dev composer config minimum-stability dev composer config prefer-stable true composer config repositories.survos_maker_bundle '{"type": "vcs", "url": "git@github.com:survos/AdminMakerBundle.git"}' composer req survos/maker-bundle composer config repositories.survos_base_bundle '{"type": "vcs", "url": "git@github.com:survos/BaseBundle.git"}' composer req survos/base-bundle:"^2.0.3" composer config repositories.ux-datatable '{"type": "vcs", "url": "git@github.com:tacman/ux-datatable.git"}' composer req tacman/ux-datatable composer require umbrella2/adminbundle php bin/console make:admin:home composer config repositories.survos_workflow '{"type": "vcs", "url": "git@github.com:survos/workflow-bundle.git"}'
bin/console make:entity -a Entity
bin/console survos:make:crud Entity
will create
@TODO:
- Extend from Umbrella
- Add DataTableBundle (ux component)
- Add #[RouteParameter] to Entity Properties.
- Make ParamConverter listen via Attributes
- Add LandingBundle (make:landing)
- Symfony 5.4 or 6
Survos Admin Bundle
A moderately-opinionated bundle that provides a quick way to get up and running with Symfony.
In particular, it sets up and uses the following:
- AdminLTE4 (Bootstrap 5)
- Knp Menu for sidebar and top nagivation
- webpack encore
- optional jQuery (for js-tree and datatables)
Assumptions
While the following can be disabled, by default the bundle assumes you want the following
- Authentication
- A user and an admin role
- Users
- An API (for Vue, DataTables)
- Bootstrap 5, icons
- Deployable on Heroku
Process
Go to ... and fill out the form with what you want. Run the script to create the Symfony shell.
Then in app.js
```javascript
require('adminkit/static/js/app');
require('../css/app.scss');
and app.scss
@import "~adminkit/static/css/app.css";
Change app.js:
require('@popperjs/core'); require('bootstrap'); require('Hinclude/hinclude'); require('./css/app.scss');
@import "~bootstrap/dist/css/bootstrap.min.css"; @import "../../public/bundles/survosbase/volt-dist/css/volt.css";
Goals
This bundle was created originally to isolate issues with other bundles and to get data on a website as quickly and painlessly as possible.
Some themes worth checking out
https://github.com/xriley/portal-theme-bs5 (check license though) https://github.com/zuramai/voler
Requirements
- composer
- PHP 7.2+
- yarn
- Symfony CLI (for running a local server, creating project, etc.)
Create github Project
-
Create a NEW repository, use lowercase if integrating with heroku
on github.com with no files (no README or license), clone it to some directory and go there.
REPO=base-bundle-demo
git clone git@github.com:survos/$REPO.git && cd $REPO
- Create the Symfony Skeleton WITHOUT a git repo, then ADD the repo. Allow recipes
rm -f LICENSE && rm -f README.md && mv .git .. && symfony new --full . --no-git --version=5.4 && mv ../.git . && git checkout . composer config extra.symfony.allow-contrib true composer req webapp && yarn install && yarn encore dev
- Create the project on heroku, after logging in. Optionally create database.
OR if you're using Sqlite.
heroku create $REPO heroku addons:create heroku-postgresql:hobby-dev echo "DATABASE_URL=$(heroku config:get DATABASE_URL)" > .env.heroku.local # Without heroku, use sqlite (or setup MySQL) echo "DATABASE_URL=sqlite:///%kernel.project_dir%/var/data.db" > .env.local
We always want some security, so certain routes can be secured. Create a User entity, and then a LoginFormAuthenticator. Tweak AppAuthenciator to return to home after a successful login. Set the MAILER_URL to the default.
bin/console make:user User --is-entity --identity-property-name=email --with-password -n #sed -i "s|public function getEmail| public function getUsername() { return \$this->getEmail(); }\n\n public function getEmail|" src/Entity/User.php sed -i "s|# MAILER_DSN|MAILER_DSN|" .env echo "1,AppAuthenticator,SecurityController,/logout," | sed "s/,/\n/g" | bin/console make:security sed -i "s|// For example.*;|return new RedirectResponse(\$this->urlGenerator->generate('app_homepage'));|" src/Security/AppAuthenticator.php sed -i "s|throw new \\Exception\('TODO\: provide a valid redirect inside '\.__FILE__\);||" src/Security/AppAuthenticator.php
Optional, since SurvosBaseBundle has this already, formatted for mobile
bin/console make:registration-form
Now install the Survos BaseBundle
composer config minimum-stability dev composer config prefer-stable true composer config repositories.knp_markdown '{"type": "vcs", "url": "git@github.com:tacman/KnpMarkdownBundle.git"}' composer req knplabs/knp-markdown-bundle:dev-symfony6 composer config repositories.survos_base_bundle '{"type": "vcs", "url": "git@github.com:survos/BaseBundle.git"}' composer config repositories.ux-datatable '{"type": "vcs", "url": "git@github.com:tacman/ux-datatable.git"}' composer req tacman/ux-datatable composer require umbrella2/adminbundle php bin/console make:admin:home composer config repositories.cs_fixer '{"type": "vcs", "url": "git@github.com:tacman/PHP-CS-Fixer.git"}' composer config repositories.survos_workflow '{"type": "vcs", "url": "git@github.com:survos/workflow-bundle.git"}' composer config repositories.tabler '{"type": "vcs", "url": "git@github.com:survos/TablerBundle.git"}' composer req survos/base-bundle:"^2.0.3" composer req survos/tabler-bundle:dev-tac composer require symfony/webpack-encore-bundle yarn install yarn add sass-loader@^11.0.0 sass --dev yarn add https://github.com/survos/adminkit.git #echo '@import "~bootstrap/dist/css/bootstrap.min.css";' > assets/styles/app.scss #echo '@import "../../public/bundles/survosbase/volt-dist/css/volt.css";' >>assets/styles/app.scss ## FIRST, initialize SurvosBase, which creates app.scss. Then fix webpack. sed -i "s|//.enableSassLoader()|.enableSassLoader()|" webpack.config.js sed -i "s|import './styles/app.css';|import './styles/app.scss';|" assets/js/app.js yarn install yarn add "@symfony/webpack-encore@^1.0.0" yarn add "@symfony/stimulus-bridge@^2.0.0" yarn add bootstrap@next yarn add datatables.net-bs5 datatables.net-buttons-bs5 datatables.net-scroller datatables.net-scroller-bs5 datatables.net-select-bs5 datatables.net-searchpanes datatables.net-searchpanes-bs5 datatables.net-colreorder datatables.net-colreorder-bs5
Survos Dev only
composer config repositories.survos_base_bundle '{"type": "path", "url": "../Survos/BaseBundle"}'
composer config repositories.geonames '{"type": "path", "url": "../Survos/geonames-bundle"}'
composer config repositories.phpspreadsheet '{"type": "path", "url": "../Survos/phpspreadsheet-bundle"}'
@TODO: recipes!
composer config repositories.multisearch '{"type": "vcs", "url": "git@github.com:tacman/PetkoparaMultiSearchBundle.git"}'
repositories.captcha '{"type": "vcs", "url": "git@github.com:cyrilverloop/symfony-captcha-bundle.git"}'
composer config repositories.git-survosbase '{"type": "vcs", "url": "https://github.com/survos/BaseBundle.git"}'
composer config repositories.git-geonames '{"type": "vcs", "url": "https://github.com/survos/geonames-bundle.git"}'
composer config repositories.flowdemo '{"type": "path", "url": "../Survos/../CraueFormFlowDemoBundle"}'
composer config repositories.social_post_bundle '{"type": "path", "url": "../Survos/social-post-bundle"}'
composer config repositories.social_post_bundle '{"type": "vcs", "url": "https://github.com/tacman/social-post-bundle"}'
# this is needed because it creates MAILER_DSN, which isn't created otherwise
# composer req mail
composer req knplabs/knp-menu-bundle:"^3.0@dev"
composer req survos/base-bundle:"*@dev"
phpstorm .env
OR
Step 1: Initialize Yarn Packages via Survos Init
# creates survos_base.yaml (a recipe would be nicer!)
bin/console survos:init
# edit .env and set MAILER_URL
Ugh, still doesn't work, needs a base menu
# introspection, creates menus, looks for entities, easyadmin, etc.
bin/console survos:configure
# symfony run -d yarn encore dev --watch
Integrating Facebook and other OAuth
Go to https://github.com/knpuniversity/oauth2-client-bundle#step-1-download-the-client-library
e.g.
composer require league/oauth2-facebook
The create an app and enable login: https://developers.facebook.com/apps/
Need a config script that asks for the ID and sets it in .env.local (or Heroku, etc.)
https://developers.facebook.com/apps/558324821626788/settings/basic/
Install and Configure UserBundle (optional)
See [docs/recommended_bundles]
If developing BaseBundle
composer config repositories.survosbase '{"type": "path", "url": "../Survos/BaseBundle"}'
composer req survos/base-bundle:"*@dev"
Normal installation
Install the bundle, then go through the setup to add and configure the tools.
composer req survos/bootstrap-bundle
bin/console doctrine:schema:update --force
survos:init
First time setup, downloads jquery, bootstrap, etc. Also modifies some yaml files, and creates the first menu.
# config/packages/admin_lte.yaml routes: adminlte_welcome: app_homepage adminlte_login: app_login adminlte_profile: app_profile
@todo: Generate this Controller and templates?
# config/routes/survos_base.yaml survos_base: {path: /, controller: 'Survos\BootstrapBundle\Controller\BaseController::base'} # app_homepage: {path: /, controller: 'Survos\BootstrapBundle\Controller\LandingController::base'} app_logo: {path: /logo, controller: 'Survos\BootstrapBundle\Controller\BaseController::logo'} app_profile: {path: /profile, controller: 'Survos\BootstrapBundle\Controller\BaseController::profile'} # profile: {path: /profile, controller: 'Survos\BootstrapBundle\Controller\LandingController::profile'} # logout: {path: /logout, controller: 'Survos\BootstrapBundle\Controller\LandingController::logout'} # required if app_profile is used, since you can change the password from the profile app_change_password: {path: /change-password, controller: 'Survos\BootstrapBundle\Controller\BaseController::changePassword'}
{% extends '@SurvosBaseBundle/layout/default-layout.html.twig' %} {% block page_content %} {{ block('body') }} {% endblock %}
{% block logo_mini %}KPA{% endblock %} {% block logo_large 'KPA Admin' %}
{% block page_title 'KPA Admin' %} {% block page_subtitle 'Songs and Music!' %}
2021 Goal: Remove jQuery
https://tobiasahlin.com/blog/move-from-jquery-to-vanilla-javascript/
use vue or react instead. https://www.smashingmagazine.com/2020/07/desktop-apps-electron-vue-javascript/k
Now install some bundles!
See the details at [Recommended Bundles](docs/recommended-bundles.md)
If you chosen to integrate the userbundle, update the schema and add an admin
bin/console doctrine:schema:update --force
symfony server:start --no-tls
When finished, the application will have a basic base page with top navigation, optionally including login/registration pages. Logged in users with ROLE_ADMIN will also (optionally) have links to easyadmin and api-platform.
Api Platform
@todo: put this in a survos:setup command.
- Expose the API routes (for jsRoutingBundle), and
# config/routes/api_platform.yaml api_platform: resource: . type: api_platform prefix: /api options: expose: true
Create resources.yaml to store the configuration
# api/config/api_platform/resources.yaml App\Entity\User: ~ App\Entity\Location: shortName: 'Location' # optional description: 'A place within a building where inventory item is physically located.' # optional attributes: # optional pagination_items_per_page: 30 # optional normalization_context: groups: ['jstree'] denormalization_context: groups: ['jstree']
Add the resources.yaml directory to the mapping paths
# config/packages/api_platform.yaml api_platform: mapping: paths: - '%kernel.project_dir%/src/Entity' - '%kernel.project_dir%/config/api_platform' # yaml or xml directory configuration] patch_formats: json: ['application/merge-patch+json'] swagger: versions: [3]
Configure the serializer (may need to create the directory)
# config/serializer/serialization.yaml App\Entity\User: attributes: id: groups: ['Default'] email: groups: ['Default'] App\Entity\Song: attributes: title: groups: ['Default']
Customizing the bundle
Deploy to heroku
heroku create $projectName
heroku buildpacks:add heroku/php
heroku buildpacks:add heroku/nodejs
echo "web: vendor/bin/heroku-php-nginx -C heroku-nginx.conf -F fpm_custom.conf public/" > Procfile
heroku buildpacks:add heroku/nodejs
heroku buildpacks:add --index 2 heroku/nodejs
composer config --unset repositories.survosbase && composer update
git commit -m "unset survosbase" . && git push heroku master
https://devcenter.heroku.com/articles/deploying-symfony4 bin/console survos:setup-heroku