What is the best symfony file system abstract layer ?
i need to set up a file system at my symfony project, something similar to dropbox.
i dont know where the files/medias are going to be stored or how, so thats why i need that abstract layer, to set it up and dont bother about updateing the files location.
what i need to do:
-adding folders/files
-moveing folder/files to another lcoation
-delating folder/files
-download folder/files
-upload folder/files
-editing folder/files
-editing name of folder/files
do you know any good bundles for it ? any good solutioins for symfony 2 ?
and please tell my why can this solution be good for my ?
The currently available options seem to be:
1) Gaufrette
In order to transfer something you need to put it in memory first. This is a problem when you have to deal with huge files. Gaufrette has filesystem abstraction layer, but makes it impossible to move objects between filesystems. Some essential features are also missing, for example - removing a directory.
Feels more like a key-value storage emulator with different adapters.
2) Filicious
On paper seem promising, but in fact its not. The documentation is all wrong. It mentions namespaces that does not exist and classes that are not to be found. Most of the stuff around Filicious currently don't seem to be implemented. The only working adapter as of now is the Local one. You can track the progress on their website.
3) Flysystem
Looks better than the above mentioned. Has stream support. They also have this MountManager, which you can use for transferring files between different filesystems.
In summary, my choice would be Flysystem. You should better check it yourself if it will fit your requirements.
https://github.com/KnpLabs/KnpGaufretteBundle
Certainly the most in-depth implementation, it includes dropbox.
Related
It is generally adviced to store module assets inside the module's directory, inside moduleName/public (or whatever you want to name the asset's directory).
Zend Framework 2 unfortunately doesn't support asset publishing for module assets by default. According to MWOP, there was nothing planned ~1 month ago and I guess there still is no real plan (they had probably a lot of work to get the stable version ready). (But, some day, they are going to address this issue.)
As my ZF2 app is growing and growing, I reached the point where I need to have module-specific assets. At the moment, I maintain them inside the module directories and copy them to the application's public directory. You can imagine that this method is error-prone and exhausting.
How do you handle this problem? Is there maybe a simple solution to this issue with little coding effort? My project plan doesn't allow me to create a complex asset handling on my own. Is there a recommendable, lightweight asset framework compatible to ZF2? I've already considered creating symlinks but I don't think this would be the best solution because it would require some additional web server configuration (FollowSymlinks) and additional maintenance work (the app is developed locally and deployed on a remote server).
Thanks in advance.
This has been discussed before in many places and it comes down to three ways to manage this.
Copy and Paste the assets into the public/ directory
Use symlinks
Use an asset loading module like assetic
A simple solution would be to make the copying of assets part of you build process.
Another question was already asked How to merge Zend Framework 2 module public directories for info.
I know this is pretty old, but I wanted to add this information for other readers.
Now there's also a module for this, which has been fully tested and is being used (and even depended on) by many modules.
Check it out here: https://github.com/RWOverdijk/AssetManager
Hope this helps.
There is also fourth option. Use a directory Alias in VirtualHost configuration.
I'm new to Symfony2, even though I knew symfony 1.4.
In my new project, I need a way to be able to load data from various text files (csv, xml, other), from various locations, in the most generic way possible, i.e. adding a new file to be checked should only require some configuration.
What's the symfon-iest way of doing that ?
Whilst I don't know of the implementation details for Symfony specifically; Gaufrette is a good PHP5 file system layer abstraction layer and they provide a Symfony bundle so it should be easy to get up and running. There are also details on getting it going on Symfony 2 in the read me documentation (scroll down).
You can easily add your own drivers for other file systems such as S3 (already implemented in base package).
I'm interested in cleaning up my codeigniter applications folder (just to clean up the clutter). I've seen a few applications that only include the important folder (ex. controllers, models, views, config) and do away with alot of the other stuff (like logs, hooks etc.)
Does someone know which folders can be deleted and which are required?
Thanks
Consider that this "clean up" won't bring you this great advantages, apart from your personal feelings. Since Codeigniter tries to look into application folders which are named like the system ones (libraries, core..) before going to search for those folders inside the "system", I don't think it will be painless to remove them; you might try, though, and just keep those which, very likely, contain somethin: config,controllers,errors,models,views.
Another thing you could do, and which will free more "space" (are you worried about file count?), is deleting unused/unwanted helpers and libraries (from the system folder); the ones you are damn sure you don't use and never will in the future (like the javascript library, for ex, plainly useless, or the smiley helper...You got the point).
All in all, apart from the feeling of "having cleaned up your workspace", I don't really see what benefit this will bring you. But, if you really, really feel so strongly inclined to, make a back-up copy and start deleting, you can always put them back if CI yells at you.
Each file and folder in the CodeIgniter Application folder is an extension of the whole CodeIgniter framework in one form or another, and should not be tampered with. CodeIgniter is a light, fast framework, and should not need any other "modifications". If you'd like to play around with CodeIgniter though to try out any "improvements"; I'd check out their page on GitHub, view some commits that may be related to your question, and play around with it yourself on your own machine.
The framework is setup so you can develop your applications and update to new versions of code igniter without breaking said applications. You don't want to start messing with the actual framework that's just asking for random errors.
if you are trying to make it as lite as possible just auto load the libraries and helpers that you require directly into the controller where they are needed.
-L
I am looking to reduce redundancies in code shared across entire web sites. I have tinkered with several frameworks but cannot think of any that allow you to EASILY separate the framework code from the site code while sharing it to multiple sites at the same time.
What PHP frameworks can do this easily?
EDIT - I am trying to determine which frameworks are the easiest to share.. I was already guessing that nearly all could be shared, but which frameworks are geared towards sharing? It sounds like Yii recommends placing the framework code outside the site code, that is a good start.
If someone is sharing the same framework code across sites already, I would love to know about that.
It's pretty easy to do that with Fuel (http://fuelphp.com).
Each website has an index.php where some paths are defined:
/**
* Set all the paths here
*/
$app_path = '../fuel/app/';
$package_path = '../fuel/packages/';
$core_path = '../fuel/core/';
As you can see, you may share the core and packages in a central repository and create a single app and public folders to each web site.
You may even share an app with different web sites customizing stuff (let's say, the site title or the database used) by just setting a different environment in the .htaccess. That works out-of-the-box for development/stage/production sites, for example, but may be extended to anything. You may also setup central packages to use in multiple apps. Powerful, easy and just works.
Many can do this. For instance YII is supposed to be installed OUTSIDE of your www-root directory (httpdocs, /var/www/ or something like that). You can use several sites to point to that base dir.
Any framework (or part) that does not need specific settings for your site can be shared among multiple sites I guess.
I believe Zend can do what you ask, possibly even Symfony and Fuel, and I'm sure many other frameworks that allow you to pick what parts of it to use will let you do this.
However, doing so will require you to do a little more configuring to get it all running. Which is kind of why I ended up creating my own framework.
Symfony does. I love the Symfony framework, and it comes with some great frameworks. You might like the Routing and YAML ones. A person I know calls Symfony the best php framework.
Symfony components
Some of the components have their own specific sites
You can find a really good documentation here.
Symfony2 is suitable for your needs. It's a full stack framework with a lot of standalone components. It works with "bundles", a bundle is a kind of container with a complete logic (controllers, model objects, views, assets, configuration, ...). That means you write one bundle and you can reuse it without any problem.
But you can also consider symfony 1.4. One project can handles many applications so your model is shared across these applications and the same code can be reused in all applications. Note an application can be a complete website.
I can't think of any frameworks that do this natively, but you could use several SVN (or hg, etc) repositories to accomplish this. Example using CakePHP:
1 repo has the CakePHP default files. If you wish to update CakePHP,
you update this repo in the future.
1 repo per website that stores everything inside your app folder.
It's not built in functionality, but it isn't very difficult to setup either.
I'm working on releasing a PHP framework I have been using for a few years
on github. Been trying to read up on the most correct way a project
should be structured, what extra files such as readme's etc should be
added. Been coming up with blanks on google. Can anyone point me to a
project that's a good example or any good write ups.
Some PHP projects hosted on Git(hub) include:
CakePHP
Gallery3
Garden
PHPUnit
Kohana
I'd just make sure that no temporary files, etc. get in the repository by creating a .gitignore file, and add some readme's etc. to the root of the repository.
Any configuration files should also be ignored, and sample configuration files should be created in the repository.
I'd recommend writing the readme file in a format that Github supports, like Markdown. It'll make your repository front page look better.
You might want to follow some kind of class naming guideline to make things like autoloading easier to implement. For example, the class MyFramework_Controller should be located at directory /lib/MyFramework/Controller.php.
You should just create some kind of basic layout for now - it'll be easier to give suggestions when we can see what you have right now.