metabolism / wordpress-bundle

Use Wordpress and Symfony together using a Symfony bundle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Symfony 4?

truckee opened this issue · comments

Any plans for Symfony 4 compatibility? Attempts to composer require metabolism/wordpress-bundle, even after adding https://wpackagist.org as a repository, in a fresh Symfony 4.3 installation results in

Your requirements could not be resolved to an installable set of packages.

Hello @truckee, I've added a boilerplate to help you start using this bundle : https://github.com/wearemetabolism/boilerplate-symfony

Please tell me if it's working :)

Works better with
git clone https://git@github.com/wearemetabolism/boilerplate-symfony.git project_name but here's my result:

PS G:\Documents\workspace> git clone https://git@github.com/wearemetabolism/boilerplate-symfony.git metamatch
Cloning into 'metamatch'...
remote: Enumerating objects: 157, done.
remote: Counting objects: 100% (157/157), done.
remote: Compressing objects: 100% (126/126), done.
Receiving objects:  92% (145/157)    157 (delta 15), pack-reused 0 eceiving objects:  88% (139/157)
Receiving objects: 100% (157/157), 280.58 KiB | 0 bytes/s, done.
Resolving deltas: 100% (15/15), done.
Checking connectivity... done.
PS G:\Documents\workspace> cd metamatch
PS G:\Documents\workspace\metamatch> composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 62 installs, 0 updates, 0 removals
  - Installing composer/installers (v1.7.0): Loading from cache
  - Installing symfony/polyfill-ctype (v1.12.0): Loading from cache
  - Installing phpoption/phpoption (1.5.0): Downloading (100%)
  - Installing vlucas/phpdotenv (v3.6.0): Downloading (100%)
  - Installing ffraenz/private-composer-installer (v2.0.0): Downloading (100%)
  - Installing symfony/filesystem (v3.4.31): Downloading (100%)
  - Installing metabolism/package-actions (1.0.3): Downloading (100%)
  - Installing metabolism/wordpress-core-installer (1.0.0): Downloading (100%)
  - Installing elliotcondon/advanced-custom-fields-pro (5.8.4):

  [FFraenz\PrivateComposerInstaller\Exception\MissingEnvException]
  Can't resolve placeholder {%ACF_PRO_KEY}. Environment variable 'ACF_PRO_KEY' is not set.


install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...

I see, you have to add your acf_pro_key in the .env
You can look at .env.sample
or remove "elliotcondon/advanced-custom-fields-pro": "5.8.*" from composer.json if don't want to use it

But you are right, there is one command missing in the documentation
cp .env.sample .env

Well, we're making progress. I get further and my error list grows:

Windows errors:

 Error: symlink action on metabolism/wordpress-bundle :
 	RecursiveDirectoryIterator::__construct(..\vendor\metabolism\wordpress-bundle\README.md,..\vendor\metabolism\wordpress-bundle\README.md): The system cannot find the path specified. (code: 3)

Because symlink is not a Windows command

  1. I use Apache/Netbeans 11.1 for an IDE. In it I attempted to use the Symfony command server:run and received this:
	In Kernel.php line 556:
																									   
	  Warning: file_put_contents(G:\Documents\workspace\metamatch/var/cache/:/dev/srcApp_KernelDevDeb  
	  ugContainerDeprecations.log): failed to open stream: No such file or directory          

	In Kernel.php line 648:
			   
	  Unable to create the cache directory (G:\Documents\workspace\metamatch/var/cache/:/dev)

This is likely due to Windows not recognizing : as a directory separator.
Edit: I've not seen : before; I'm a long-time Windows guy.

Ubuntu VM errors:

Installing elliotcondon/advanced-custom-fields-pro (5.8.4): Downloading (failed)

  [Composer\Downloader\TransportException]
  The "https://connect.advancedcustomfields.com/index.php?p=pro&a=download&k=YOURACFPROKEY&t=5.8.4" file could not
  be downloaded (HTTP/1.1 404 Not Found)

I removed the line "elliotcondon/advanced-custom-fields-pro": "5.8.*", from composer.json and finished installation

After adding php extensions required by WordPress, but not for Symfony apps running on the VM:

  1. php bin/console server:run yields:
	In load.php line 16:

	  Notice: Undefined index: SERVER_PROTOCOL

Yeah I think we need to test it better on windows, we never use this stack..

For the VM :
1 - In the .env, you need to replace YOURACFPROKEY with ... your acf pro key :D, that's why it can't find the url, removing it is a solution or you can add the free version

"wpackagist-plugin/advanced-custom-fields":"5.8.*"

2 - How do you use the bundle ? In our boilerplate there is no server:run, could you share your project ? After some research, I think you need to declare a local domain..

2019-10-03 09_38_29-Window

I think I've misunderstood this project. The folder structure of this project's installation does not match that of a Symfony 4 project. For example, there is no .../public directory. Also, you reference a document that shows the Symfony command php bin/console server:start, which also returns

$ php bin/console server:start

In load.php line 16:

  Notice: Undefined index: SERVER_PROTOCOL

Installed project structure:
metamatch

A Symfony 4 project in Netbeans (directory nbproject) looks like this:
sym4

Well you are right, web must be renamed to public, It's a relic from Symfony 2, so if I understant it, you cloned the symfony demo and added our bundle ?

Our boilerplate is a little bit different from the demo, because it uses Wordpress as a Backend we don't need to use symfony/flex but instead load lower components to optimize loading time.

If you want to start from the SF demo and use the built in server, it will need some rework in the console I guess because Wordpress requires $_SERVER['SERVER_PROTOCOL'].

I will try to reproduce your stack to see if it's something we can fix but is using our boilerplate directly a no go ?

"...cloned the symfony demo and added our bundle ?"

Actually no. Since the "boilerplate" starts with cloning a project I assumed that the clone was the starting point. Thus the cloned project goes into an empty directory. There is no prior Symfony code.

The expectation, then, is that running the boilerplate creates a project that's "ready-to-eat", that is, it's all set for me to add code to the .../src directory and whatever other customization I want to add. [While I usually assume that I can build things in Windows that is not mandatory. I'm somewhat "bilingual".]

Ok so the only "issue" we have is to work with a built-in server, meanwhile if you create a virtual host pointing to /web, it should work straight of the box...

Almost straight out of the box. The Ubuntu installation failed to create the directory var/cache/metamatch/dev probably due again to the use of : as a directory separator. Once that was fixed I was able to install WordPress. So far so good.

WordPress reported

web/wp-bundle/languages folder is not writable
web/uploads folder is not writable
web/uploads/acf-thumbnails folder doesn't exist
web/wp-bundle/upgrade folder is not writable
config/acf-json folder is not writable
var/cache folder doesn't exist

With all of these bumps along the road I cannot consider wearemetabolism/wordpress-bundle as a possible solution to my use case - merging a client's WordPress site with one of my existing Symfony apps. Best wishes, though, for your success in creating a more robust solution.

Hi @truckee , I had this discussion in mind this weekend and decided to do something, so I have reviewed the install process and fixed it.

Could you take some time to try it ?

The updated code and readme is available in the develop branch
https://github.com/wearemetabolism/wordpress-bundle/tree/develop

It has been tested on Windows to.

I think the boilerplate bundle documentation should list a quick start (clone and run), then all the steps to get from the symfony web skeleton to a functional website with Wordpress.

I do that when I'm trying to isolate a problem with a bundle, and the bundle developer ask "Can you provide a simple example showing the problem".

https://github.com/survos/select2entity-bundle-demo

Ideally, the demo repo of the boilerplace should be able to be up and running on a dev machine with a half dozen documented commands: clone, composer install, yarn install, create/load the database, start the server.

BTW, I strongly recommend using the Symfony Server rather than bin/console server:start (which is deprecated now and will be removed in Version 5 next month). It works better on Windows, and makes getting up and running much easier.

In fact the new install will copy sample files, so right after installation you will have a functional website, do you sill think a demo is required ?
I will take a look a Sf Server, thank you

I'm working on it, in fact I'm porting the twenty nineteen theme, it should be available soon.

And you are right, this bundle is not a Wordpress Api wrapper ;)