Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
0577cfd
Updates for Symfony 3.4. dependencies.
ianef May 14, 2020
146199c
Fix Symfony 3.4. versions.
ianef May 14, 2020
e896f52
Travis.yml updates.
ianef May 14, 2020
bd4e8f7
Travis.yml updates.
ianef May 14, 2020
84f09e1
Travis.yml updates.
ianef May 14, 2020
747f32d
Travis.yml updates.
ianef May 15, 2020
7ee743a
Travis.yml updates.
ianef May 15, 2020
3457245
Travis.yml updates.
ianef May 15, 2020
b7955a6
Travis.yml updates.
ianef May 15, 2020
34b58ac
Remove symfony/symfony
ianef May 16, 2020
adf7c11
Exclude ExtractedRoute from autowiring.
ianef May 16, 2020
8ce3aea
Merge branch '3.4' of github.com:XactSystems/js-routing-bundle into 3.4
ianef May 16, 2020
2335c5f
Do not autowire everything.
ianef May 16, 2020
f6c360e
Explicitly configure all injected constructor parameters.
ianef May 16, 2020
4556c8f
Updates to get the services correctly registered.
ianef May 16, 2020
33d9f21
Debegging monolog testing issue.
ianef May 18, 2020
3802748
Temporary fix for monlog issues by overwriting the monolog.yaml file.…
ianef May 18, 2020
21fab7b
Add missing monolog.yaml file.
ianef May 18, 2020
283ed58
Debug monolog hack fix.
ianef May 18, 2020
811284f
Debug monolog hack fix.
ianef May 18, 2020
549e7b8
Travis.yml tidy up.
ianef May 18, 2020
180b7b5
Update to installation instructions for 3.4.
ianef May 18, 2020
1b71a1a
Fix vendor path in instructions.
ianef May 18, 2020
c9ce109
Update installation instructions for 3.4, now on packagist.
ianef May 18, 2020
dee44f5
Update README to reflect changes required for 3.4.
ianef Sep 4, 2020
e380dad
FIx import path.
ianef Sep 4, 2020
684db34
Build routing context and check for app_dev.php.
ianef Sep 30, 2020
c1d7c91
Simplify .travis.yml
ianef Sep 30, 2020
e243c82
Reconfigure phpunit.xml.dist
ianef Sep 30, 2020
a3856c4
Fix up tests and add TestKernel.
ianef Sep 30, 2020
b4ea560
Remove composer version.
ianef Sep 30, 2020
91c0d11
Fix up dependencies and test setup.
ianef Oct 1, 2020
6b1d78f
PSR-12 standards updates.
ianef Oct 1, 2020
e36123d
Merge pull request #3 from XactSystems/3.4-dev
ianef Oct 1, 2020
317d0bd
Remove the routing element data after loading.
Sep 3, 2021
a3cf149
Use phpunit-bridge and update phpunit schema to try and overcome Trav…
Sep 3, 2021
dea68fc
Merge pull request #4 from XactSystems/3.4-dev
ianef Sep 3, 2021
ba97692
Fix spelling errors and remove redundant Resource/doc files
Oct 29, 2021
ede4a83
Fix spelling errors and remove redundant Resource/doc files
Oct 29, 2021
d0ee338
Updates for Symfony 6 and 7.
ianef Sep 25, 2024
e05d6f2
Remove version.
ianef Sep 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

/composer.lock
/phpunit.xml
/.phpunit.result.cache

/var/
/vendor/
35 changes: 5 additions & 30 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ cache:
directories:
- $HOME/.composer/cache/files
- $HOME/symfony-bridge/.phpunit


git:
clone: false

env:
global:
- PHPUNIT_FLAGS="-v"
Expand All @@ -18,37 +13,17 @@ env:
matrix:
fast_finish: true
include:
# Test the latest stable release
# Test the 3.4 LTS release
- php: 7.2
env: SYMFONY="3.4.*"
- php: 7.3
env: SYMFONY=">=5.0-stable"

# Latest commit to master
- php: 7.3
env: SYMFONY=">=5.0-dev"

allow_failures:
# Dev-master is allowed to fail.
- env: SYMFONY=">=5.0-dev"

before_install:
- if [[ $COVERAGE != true ]]; then phpenv config-rm xdebug.ini || true; fi
- if ! [ -z "$SYMFONY" ]; then composer create-project symfony/website-skeleton:$SYMFONY symfony; fi
- if [ -z "$SYMFONY" ]; then composer create-project symfony/website-skeleton symfony; fi
- cd symfony
- composer config repositories.xactsystems vcs https://github.com/XactSystems/js-routing-bundle.git --no-interaction
# Does not work for private repos, needs SSH key or other auth
- composer require xactsystems/js-routing-bundle:dev-$TRAVIS_BRANCH --no-interaction
- cat vendor/composer/autoload_psr4.php
#- git clone --depth=50 --branch=$TRAVIS_BRANCH https://github.com/XactSystems/js-routing-bundle.git XactSystems/js-routing-bundle
env: SYMFONY="3.4.*"

install:
- ls -al vendor/xactsystems
- cp -p vendor/xactsystems/js-routing-bundle/phpunit.xml.dist .
- ./vendor/bin/simple-phpunit install
- travis_retry composer install --no-interaction --prefer-dist

script:
#- composer validate --strict --no-check-lock
# simple-phpunit is the PHPUnit wrapper provided by the PHPUnit Bridge component and
# it helps with testing legacy code and deprecations (composer require symfony/phpunit-bridge)
- export SYMFONY_DEPRECATIONS_HELPER=disabled
- ./vendor/bin/simple-phpunit $PHPUNIT_FLAGS
43 changes: 0 additions & 43 deletions Controller/RoutingController.php

This file was deleted.

31 changes: 0 additions & 31 deletions DependencyInjection/XactJSRoutingExtension.php

This file was deleted.

119 changes: 0 additions & 119 deletions Extractor/ExtractedRoute.php

This file was deleted.

44 changes: 36 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,39 +1,67 @@
XactJSRoutingBundle
===============

This bundle allows you to expose your Symfony routes and use them in your webpack managed JavaScript code.
It allows you to easily intergrate the functionality of the FOSJsRoutingBundle into webpack modules.
This bundle allows you to expose your Symfony routes and use them in your webpack or vite managed JavaScript code.
It allows you to easily integrate the functionality of the FOSJsRoutingBundle into ES modules.

Documentation
-------------
### 1) Add JSRoutingBundle to your project

```bash
composer require XactSystems/js-routing-bundle
composer require xactsystems/js-routing-bundle
```
For Symfony 3.4 use:
```bash
composer require xactsystems/js-routing-bundle:^3.4
```

### 2) Include the routing template in your base Twig template
```twig
// templates/base.html.twig

{{ include("@XactJSRouting/js-routing.html.twig") }}
{{ include("@XactJSRouting/xact-routing.html.twig") }}
```

### 3) Include the JS module in your App.js
The package installation will automatically update your package.json file to import xact-routing module.
After running composer, run:
```bash
npm install
```
Add routing to your App.js file, and/or other scripts as required:
```javascript
// assets/js/App.js

// Import the JS routing scripts
import '../../vendor/ianfoulds/js-routing/assets/js-routing.js';
// Import the JS routing class
import Routing from 'xact-routing';
```
The actual path to the js-routing.js file may not be exactly as shown, you may need to adjust this for your own project.

### 4) Using the routing class, exactly as you would with FOS bundle
```javascript
// Get the URL of your routes
let url1 = Routing.generate('home');
let url2 = Routing.generate('some-other-route', {id: myLocalId, state: myLocalState});
```
### 5) For Symfony 3.4, if you are not using Flex and ENV you may need to add the following:
```php
// app/AppKernel.php

public function registerBundles()
{
// You many need to do this to get the render(controller()) Twig method working for XactJSRoutingBundle
$_ENV["APP_ENV"] = $this->getEnvironment();
```
And for the Symfony Serializer component:
```yaml
// app/config/config.yml

framework:
...
# If you haven't already enabled the Symfony Serializer
serializer: { enabled: true }
```

Credits
-------

Expand All @@ -47,4 +75,4 @@ License
This bundle is released under the MIT license. See the complete license in the
bundle:

[LICENSE](https://github.com/ianfoulds/js-routing-bundle/blob/master/LICENSE)
[LICENSE](https://github.com/ianfoulds/js-routing-bundle/blob/master/LICENSE)
2 changes: 0 additions & 2 deletions Resources/doc/index.rst

This file was deleted.

3 changes: 0 additions & 3 deletions Resources/templates/js-routing.html.twig

This file was deleted.

12 changes: 0 additions & 12 deletions XactJSRoutingBundle.php

This file was deleted.

14 changes: 0 additions & 14 deletions assets/js-routing.js

This file was deleted.

Loading