I want to write yet another REST service, but this time using ZF tool. I wonder if there are already suitable project profiles for that around?
After creating a project with a default profile zf tool says
Note: This command created a web project, for more information setting up your VHOST, please see docs/README
Obvious to assume there exists a profile mechanism and hopefully other profiles.
Let me know if you came across those non-vanilla profiles (REST, console, etc.). Documentation per say seems to be a bit silent on custom profiling. Note: Alternatively a tutorial on developing your own custom profile is welcomed.
PS In case of REST it is obvious enough that one can reuse vanilla web profile following steps similar to this tutorial. But it would be much nicer to have a profile that takes into consideration better practice of using REST router as in here (hence a proper non-RPC approach).
[EDIT]
first part of the question - working with project profiles of
zf-tool is a duplicate of
zf create project path name-of-profile file-of-profile
second part of the question is to find/create such profile for
REST (based on ZF)
code & tutorial: https://github.com/codeinchaos/restful-zend-framework
Related
I needed to know which folder is more suitable to host my Rest API in Yii2 template advanced, backend or frontend.
I also saw some examples where developers created a new directory, called it "api" and programmed the API from there, but I don't find much information by developing from this method.
If you know the most correct way to do it, I would apreciate if you could explain me.
That totally depends on your requirements if it is going to be a complete full app or just a single controller with a few actions or a single ActiveController.
But a good way is to keep things separate just like you are using the advance-app and you have the backend and frontend folders so that you can differentiate the code base, and keep the code in their concerned folders, those folders are actually 2 separate applications running separately with their own separate configurations i.e backend/config/* and frontend/config/*, and can share some common configurations like database and others from the common/config/*. Same like that you can create a separate application/folder where you can have all the code base and configurations related to api you are going to build.
You can find a very good reference for adding more apps into your existing application by Yii here on GITHUB which will clear your concept about how to add more apps.
Then you can go to this article by Budi Irawan's Tech Blog which uses the advance-app to add a new application for the API. You will find the directory structure with example models and controllers along with testing them with POSTMAN.
Backend and frontend are also just a folder in the Yii2 advance app with just namespace different, they are different for our understanding, it is not necessary that you use backend for backend purpose only.
So for the API, you can use any of these folders, but it is always recommended to put thing separately like we put backend thing in backend folder and frontend things in frontend folder.
It's totally up to you and your coding style.
i prefer putting Rest API into a separate module, for instance into "common\modules\api". that way i can "mount" the api in backend or frontend via configuration. Also, nice urls are automatically provided, like /api/<controller>/<action> (where api is the name of your module).
One more thing to consider is how to update your api. in case of modules everything is well organized. you could start with "v1" and put your controllers in here, and move up to "v2" with a different set of controllers. so your first api endpoint would read /v1/users, later on you can additionally provide /v2/users.
more about modules here
read "URL Rules" here
I am looking to implement Angular2 inside my current Laravel project. I've read about many setups including AngularClass's version with Webpack, but I feel like it's all over-complicated.
What I wish to make:
A simple single page app inside my Laravel app.
It needs to have something like Grunt/Gulp or even Webpack to compile upon changes.
Does not need NodeJs to run in production, no lite-server, just like AngularJS it can be injected and that's it.
I need to understand the implementation files to achieve this, so no starterpack or angular-cli, unless if you can supply good arguments.
Looking for a "how to"-like example on creating the above.
Thanks in advance.
EDIT: More information
As ANKH pointed out, i needed a more detailed and coursed question. So here we go:
- Looking for a example implementation of a Angular2 based SPA inside an existing PHP application (Laravel).
- I've tried many different tutorials, going from the heroes tour, to Sitepoint and AngularCLI based tutorials, but they all assume a SPA on it's own. Ergo, they are compiled and served through NodeJS, which I don't need.
Turns out that I've actually been looking at this entirely wrong. I've gone with using Angular-cli and found that I could generate the output files and include these inside my Laravel project. No need to integrate them further.
in our team we started to migrate an very old PHP-newbie project to cakePHP and I'd like you to ask about how to structure some parts of it:
We have:
The cakePHP coreSources seperated in a vendors-directory
The application (app)
So now the question is how to structure addional parts of the application which are seperated due to permissions. But they are related to the application and in the old version much sourcecode is duplicated which we want to avoid.
admin tools panel
payment panel
support panel (lets say kind of help desk)
I'd like to keep them in seperated GIT repositories (as they are written by us and not 3rd party/vendors) and I dont want one huge repo which keeps the application and all of its addional panels.
So the question is: How to build this in cakePHP to avoid duplicate sourcecode? Example: A message written in the app should be visible in the suport panel when its reported as spam or bad words. (Do you understand what I mean?)
Shall we use plugins for the several panels or shall we build completly own cake-apps which will lead again to duplicate sourcecode? Are there other ways to deal with this problem?
Greetz
P.S. Sorry for my bad english.
If I understood you right you want to have modules that can be shared between applications. Plugins are the right choice then. You can manage them in git repos but I would use composer to install them in your apps.
Just putting something in a plugin won't make everything 100% reuseable and extendible make sure you write your code in a way that it can be extended using OOP principles and design patterns on app level if needed.
I've done a lot of research and before I get into this new project I wan to ask you for opinon of arhitecture I should take.
I am creating an application that is build with multiple modules that are not connected and I want to sperate them as modules. They will be developed separately. Now I want to find a best way to create this in ZF. First idea was to just change path to zf library to external resource and put every project seperate but then session and variables that needs to be common are seprate wich isnt good. What I want is single authentication point (like sign-in on google) and then have this modules (like gmail, calendar, google search etc.).
Next idea is to build subdomains and based on them do some routing: api.example.com -> api module, account.example.com -> another module etc. I found this here: Zend Framework 2 Routing subdomains to module or here Adding sub domain based routes in Zend framework .If this is the right way wich is better?
Another idea is to switch settings in bootstrap. So if request comes from api subdomain set APLICATION_PATH to api/ else to something else. But I dont think I could use same session then.
Third is to create rest auth service and then use the second way to achive this.
Any suggestions or ideas how could I achive this?
Sei ying there is no special move that is best, it all depends, any
move could be best, its up to you when the times right, to move
correctly, accurately and with great speed...
To sum it up: you have to choose which methods are best for your use case.
Developing separate Modules doesn't mean they won't share the same session once put into one application. There are already dozen of Authentication Modules out there that are able to connect to authenticate against google, too.
If you develop said modules: "Login", "Calendar", "Gmail" and then you put them all into your "MySuperApplication"-Application, then those will share the same browser-session. You'd however make sure that each of those has the proper interfaces to talk to each other.
It's really difficult to answer your question as it appears that you do not really understand the basics of how ZF2 works, therefore my only suggestion can be to start developing and come up with real questions ;)
I have a web application that needs to be built using PHP/MySQL. The application will require documents to be generated from data in the MySQL database. Such documents will be printed and/or emailed and user will be prompted to run a daily print/email job based on business logic.
This application functionality needs to be made available to individual users such that they can upload data, have the system prompt them as to whether letters/emails are to be generated. The site also needs to be able to support a bulletin board, online live training events and will have admin area as well.
Question: Should a hybrid solution be developed such that the data management (upload functionality, and letter production) be a separate part of the site that authenticated Joomla users can access? That is, the document management functionality would exist separately from Joomla, but be called from within it via a link in the Joomla sitemap. Alternatively, should custom modules be developed from within Joomla to accomodate the document management functionality?
Thanks so much for your input!!
Joomla could do the job for you but based on the amount of things you need that differ from a normal Joomla site I would use a framework to build from instead of a CMS. I say this because it sounds like you need a lot more than just a CMS and it can be more work if you try making Joomla do things it wasn't designed to do. In my opinion Joomla is for "web sites" and not as much for "web apps". Of course those terms have overlap but it sounds like you would be better off with a Framework to go off of instead of working around Joomla to get what you want. However if the site is already done in Joomla it may be less work just to make a Joomla add-on.
Since you have to use PHP I would definitely recommend CakePHP for your framework. As for an integrated forum try looking at the links in this post. If that doesn't work for you, try out Vanilla forums (vanillaforums.org) which are very clean and may be easier to integrate into CakePHP than some of the other PHP forums.
If you decide to use CakePHP, check out Cake Forge to see if you can find anything there to make your life even easier.
If you were to use Joomla, the upload functionality and letter production would be written as a custom component. You can write the component to make sure that the current user is authenticated before generating the documents. I would not develop this as a separate application alongside Joomla; it would be easier to write it as a component.
Many forums and forum bridges are available for Joomla, so that would be something you wouldn't have to write.
I'm not sure what kind of live event support you're looking for.